Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added local file upload (Issue#4) #15

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

Conversation

AbdulKabia
Copy link

This PR addresses Issue#4, I've added a page that users can use to upload files to and get back the file's information.

However, I noticed that there is an issue with some async calls. For instance, in the file routes/index.js, the router.get() function renders the result page before actually getting the information and populating arr1, which leads to an empty result page the first time it loads, but if it were to be refreshed, it would be fine. The same thing happens with the route.post() functionality as well. Some help on this would be greatly appricated @marcobeltempo

@marcobeltempo marcobeltempo self-requested a review April 26, 2018 22:27
@marcobeltempo
Copy link
Owner

Thank you for the PR @AbdulKabia.

The front end is used as a way to demo fileside's built-in functions. I tested the upload feature which seems to work. Similar to how multer is built on top of busyboy, we would need to implement a library function that attached a file object to the req object.

fileside allow's users to install the library and use its built-in functions. In src/chaddon.js is where you can find the function implementations.

For example:

Lets take a look at the getFileBytes function in src/fileside.js#L21-L30

This allows the user to simply import the package and allow fileside do the work.

var fileside = require("fileside");
var testFile = "/app/index.js";

fileside.getFileBytes(testFile, function(err, result) {
  console.log(result);
});

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

Successfully merging this pull request may close these issues.

2 participants