Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js nodejs gridfs缓冲区偏移了两个字节_Node.js_Mongodb_Gridfs - Fatal编程技术网

Node.js nodejs gridfs缓冲区偏移了两个字节

Node.js nodejs gridfs缓冲区偏移了两个字节,node.js,mongodb,gridfs,Node.js,Mongodb,Gridfs,我正在使用此函数检索文件。在此之前,还有一些其他函数调用将md5sum从请求中提取出来,确保该文件存在,然后调用buildFile() 下面是结果转储 磁盘上的原始文件(通过mongofiles导入,可以通过mongofiles正确检索) nodejs的输出 ~/_nodejs% hexdump -C OUTPUT 00000000 11 00 00 00 41 42 43 44 45 46 47 48 49 4a 4b 4c |....ABCDEFGHIJKL| 00000010 4d

我正在使用此函数检索文件。在此之前,还有一些其他函数调用将md5sum从请求中提取出来,确保该文件存在,然后调用buildFile()

下面是结果转储

磁盘上的原始文件(通过mongofiles导入,可以通过mongofiles正确检索)

nodejs的输出

~/_nodejs% hexdump -C OUTPUT
00000000  11 00 00 00 41 42 43 44  45 46 47 48 49 4a 4b 4c  |....ABCDEFGHIJKL|
00000010  4d                                                |M|
00000011
如果我们
console.log
Buffer对象,我们也会看到额外的数据:

 <Buffer 11 00 00 00 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d>


一段时间以来,我一直在为这件事绞尽脑汁,不知道下一步该怎么办。这就像
gridfs.get()
只是返回了错误的数据。

能否在git repo上发布一个问题,请提供节点版本、mongodb版本、驱动程序版本和复制步骤(最好是代码)。否则我就有点瞎了

~/_nodejs% hexdump -C OUTPUT
00000000  11 00 00 00 41 42 43 44  45 46 47 48 49 4a 4b 4c  |....ABCDEFGHIJKL|
00000010  4d                                                |M|
00000011
 <Buffer 11 00 00 00 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d>