feathersjs-ecosystem / feathers-blob

Feathers service for blob storage, like S3.
http://feathersjs.com
MIT License
92 stars 32 forks source link

docs: get does not return buffer #71

Closed florianbepunkt closed 4 years ago

florianbepunkt commented 4 years ago

Steps to reproduce

A Service.get() operation does not return data the same format as in create (as stated in the Readme):

blobService.get(id, params) returns output data of the same form as create.

Service.create() accepts an object with either an uri or a Buffer, but get only returns an uri.

Expected behavior

Buffer object should be provided or docs clarified.

I can put together a PR. Please let me know if this is an issue with the docs or the get implementation (or intended).

claustres commented 4 years ago

Yes this is related to the docs, although this is specified here and here: returns output 'data' of the form:. Maybe we can add whatever the input data (uri or buffer) ?

Anyway returning buffer should also be possible as detailed in https://github.com/feathersjs-ecosystem/feathers-blob/issues/69. Always welcome a PR on this !

florianbepunkt commented 4 years ago

I agree with your proposal as stated in #69, leaving status quo as default for backwards compatibility.

My use case is that I get files and pass them as buffer to another service. Currently the file gets fetched as a stream, converted to a buffer, converted to a string in order so that I convert it back to a buffer. This adds unnecessary overhead.

Will throw together a PR.