fileFromSync just part of a file
leopucci opened this issue · 1 comments
leopucci commented
Hey there! Nice work!
I am trying to append on a form just part of a file,
Is there some way that I could append fom 0 to 1024 bytes on fileFromSync(0,1024,/path/to/file)
Thanks
Pucci
jimmywarting commented
just do:
fileFromSync(path).slice(0, 1024)
it's quite cheap operation do create new chunk, nothing will ever be read into memory by using fileFromSync
until you actually try to read anything
a Blob/File is more like a references (file handle) that points to a location on the disk from where it can be read from
when you slice()
then you are creating a new Blob chunk with a different size & offset