Giter Club home page Giter Club logo

gridfile's Introduction

abskmj

  • Works on Node.js, MongoDB, Docker, Kubernetes to develop & deploy new apps.
  • Writes most of his code in JavaScript.

Sponsor

gridfile's People

Contributors

abskmj avatar dependabot[bot] avatar jsassassin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gridfile's Issues

Download to string

Do you know if is possible to return a GridFS file to a string instead of a file?
I mean like requesting it with a post request and returning the content of the file in the response.

Is it possible to update metadata associated with file?

Thanks (again) for the package.

Really easy to use, loving it.

I have managed to populate the metadata field when uploading (I've changed some variable names, sorry about any funky naming):

const upload = new Upload({
  filename: req.file.originalname,
  metadata: {
    tmpName: req.file.filename,
    version: 1
  },
});
uploaded = await upload.upload(fileStream);

This upload gets associated to a parent document that contains some more advanced metadata specific to how the file is used.

I would now like to add the id of the parent doc to the upload metadata. Something like this:

Parent.create(req.body)
    .then(async (data) => {
      uploaded.metadata.template_id = data._id;

      // also tried await
      uploaded.save().then(updated => {
        return res.status(201).json(data);
      })
    })
    .catch((err) => {...});

Everything I've tried so far looks like it should work, I.e returning the data has the expected values in the metadata. but it doesn't actually make it to the database.

Have you come across this issue before and if so how did you tackle it?

Could not resolve dependency: npm ERR! peer mongoose@"^5.0.0" from [email protected]

Thanks for this plugin, it seemed to be exactly what I was looking for however trying to install it on a fresh project using mongoose 6.1.5 results in the error

Found: [email protected]
node_modules/mongoose
  mongoose@"^6.1.5" from the root project 

Could not resolve dependency:
peer mongoose@"^5.0.0" from [email protected]
node_modules/gridfile
  gridfile@"*" from the root project
Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.