storj-archived / core

Deprecated. Implementation of the Storj v2 protocol for Node.js.
https://storj.io
Other
395 stars 88 forks source link

createFileSliceStream always output the stream from the first byte irrespective of any given start byte #711

Closed hmuruges closed 7 years ago

hmuruges commented 7 years ago

Package Versions

Replace the values below using the output from npm list storj. Use npm list -g storj if installed globally.

mystorj@1.0.0 /home/hari/test
└── storj@4.0.1

Replace the values below using the output from node --version.

v6.10.3

Expected Behavior

Please describe the program's expected behavior. Include an example of your usage code in the back ticks below if applicable.

createFileSliceStream should stream the file as per the byte range given in options params ('start' till 'end').  

Actual Behavior

Please describe the program's actual behavior. Please include any stack traces or log output in the back ticks below.

The output stream from the createFileSliceStream always starts from first byte of the file. This happens for any value given in options.start param.

Steps to Reproduce

Please include the steps the reproduce the issue, numbered below. Include as much detail as possible.

  1. Upload a file.
  2. Create a file steam using createFileSliceStream for the file uploaded, in the option param provide start value other than 0. for example start as 64 and end as 127. Write the stream to a file.
  3. To confirm the issue compare the uploaded file's first 64 bytes to the output file's first 64 bytes. It will be the same, but expected is different. The output file's first 64 bytes should be the the uploaded file's byte 64 to 127.

After debugging into the code, a possible reason could be Inside the function _getSliceParams, shard.size always gives NaN because of accessing unknown object member.

braydonf commented 7 years ago

BridgeClient is deprecated here, please instead see:

Other client libraries are in progress: https://github.com/Storj/awesome-storj#client-libraries