Giter VIP home page Giter VIP logo

loopback-component-storage-gridfs-httprange's Introduction

loopback-component-storage-gridfs-httprange

This repo is modification from https://github.com/MrMartiniMo/loopback-component-storage-gridfs

Uses mongoDB GridFS to manage binary contents of your loopback application.

Inspired by

Behaviors

  • Files are identified by id, not by file name. So it is possible to have files of the same name in one container.
  • Added HTTP Range feature
  • Added Bandwidth Limit feature via datasource options

Installation

npm install --save loopback-component-storage-gridfs-httprange

Datasource

Add datasource to your datasources.json

"storage": {
   "name": "gridfs",
   "connector": "loopback-component-storage-gridfs-httprange",
   "host": "hostname",
   "port": 27017,
   "database": "database",
   "username": "username",
   "password": "password",
   "limit" : 320000
 }

username and password are optional

Options

  • name : Datasource name
  • connector : loopback-component-storage-gridfs-httprange
  • host : MongoDB Hostname
  • port : MongoDB Port
  • database : MongoDB database name
  • username : MongoDB username
  • password : MongoDB password
  • limit : Bandwidth limit when downloading file, in bit

API

List containers

GET /FileContainers
FileContainer.getContainers();

Delete container

DELETE /FileContainers/:containerName
FileContainer.deleteContainer({
  containerName: 'containerName',
  fileId: 'fileId'
});
  • containerName - name of container to delete

List files in container

GET /FileContainers/:containerName/files
FileContainer.getFiles({
  containerName: 'containerName'
});
  • containerName - name of container

Get file information

GET /FileContainers/:containerName/files/:fileId
FileContainer.getFile({
  containerName: 'containerName',
  fileId: 'fileId'
});
  • containerName - name of container
  • fileId - id of file

Delete file

DELETE /FileContainers/:containerName/files/:fileId
FileContainer.deleteFile({
  containerName: 'containerName',
  fileId: 'fileId'
});
  • containerName - name of container
  • fileId - id of file to delete

Upload files

POST /FileContainers/:containerName/upload
  • containerName - name of container

Download file

GET /FileContainers/:containerName/download/:fileId
  • containerName - name of container
  • fileId - id of file to download

loopback-component-storage-gridfs-httprange's People

Contributors

fengweilin avatar gendigbadig avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

nischayasharma

loopback-component-storage-gridfs-httprange's Issues

Not connect in production

Unhandled rejection Error: Cannot create data source "gridfs": Cannot initialize connector "loopback-component-storage-gridfs-httprange": query parameter rv rC?rz%zdwNA5JA rJVG C?rvnjs9q5?yg rJAnjsTvCxzVG C?xrv [email protected]:27017/appdb is an incomplete value pair

statusCode: 500
name: "MongoError"
message: "not authorized on appdb to execute command { find: "fs.files", filter: { _id: ObjectId

would anyone know why on the local machine it works and online gives this problem?

Problem with docker

I was trying to connect the gridfs to a docker container but it doesn't work properly.
in the output of the error log looks like this:

Captura de Tela 2021-02-15 às 11 40 50

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.