2.1.0 • Published 7 years ago

node-multi-storage-local v2.1.0

Weekly downloads
3
License
GPL-3.0
Repository
github
Last release
7 years ago

node-multi-storage-local

node-multi-storage-local is a provider for the NodeJS module node-multi-storage. It provides saving and reading files to/from the local filesystem.

Usage

Install node-multi-storage-local and node-multi-storage:

npm install --save node-multi-storage node-multi-storage-local

Create an instance of the local storage provider:

let MultiStorageLocal = require('node-multi-storage-local');
let localStorageProvider = new MultiStorageLocal(options);

and add it to the MultiStorage instance (or create it wit the provider):

let MultiStorage = require('node-multi-storage');
let storage = new MultiStorage({providers: [localStorageProvider]});

// or

let MultiStorage = require('node-multi-storage');
let storage = new MultiStorage();
storage.addProvider(localStorageProvider);

The options passed when creating a new instance of node-multi-storage-local has these fields:

  • baseDirectory: The directory where all files are saved. Defaults to the current working directory.
  • createDirectories: If set to true, all needed intermediate directories are created whenever needed. Defaults to true.
  • flattenDirectories: If set to true all directory hierarchies are flattened to so that there are no subdirectories. This is useful when developing an application. Subdirectory structures are expressed by inserting a – in the file name. Defaults to false.

Further information on how to save and read files, see the documentation of node-multi-storage.

Hints

  • The generated URLs are relative to the base directory. That means that they are still working after this directory has been moved.
  • When including the path option, get and getStream consider this is a subdirectory path.
2.1.0

7 years ago

2.0.1

7 years ago

2.0.0

7 years ago

1.2.1

8 years ago

1.2.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago