Skip to content
This repository has been archived by the owner on Oct 27, 2020. It is now read-only.

Added download by id and support to send upload stream in req.filedata #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sachinhub
Copy link

Hi,

While using this module, we felt a need to add support for following functionalities -

  1. Download by id in addition to download by name.
  2. While uploading, req object is expected to contain the stream data. However, we might read the stream before calling the API for processing like virus scanning. Hence added a support for sending upload stream in req.filedata variable as well.

@codecov-io
Copy link

Current coverage is 86.82%

Merging #7 into master will not affect coverage as of 1b8c829

@@            master      #7   diff @@
======================================
  Files            1       1       
  Stmts          129     129       
  Branches        14      14       
  Methods         30      30       
======================================
  Hit            112     112       
  Partial          0       0       
  Missed          17      17       

Review entire Coverage Diff as of 1b8c829

Powered by Codecov. Updated on successful CI builds.

@jdrouet
Copy link
Owner

jdrouet commented Feb 2, 2016

@sachinhub thank you for the pull request but there is several problems. First, the code you have done is not in coffeescript. The second problem is that you don't make tests. Next, the prototype you need deffer from the standard loopback component storage (which is not really a problem). Could you fix it ?

//return req.pipe(busboy);

// There may be a requirement to read the req stream before calling this function. e.g. to do virus scanning in temporary location.
// The file stream can again be attached to req.filedata and passed to this function in that case.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you store it in temporary location, you store it on the filesystem ? What is the difference between storing it in the filesystem and storing it in database ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes @jdrouet. We store in a folder on file system and then execute a virus scan script on it. The folder is quarantine.

Once the virus scan command returns okay, we upload it in database. We dont want to upload in database until it passes virus scanning tests.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sachinhub I think that you need to use the standard component storage first then upload it to database

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants