# node-multi-storage-local

> A provider for multi-storage for the local filesystem.

Latest version **2.1.0** (published 2017-03-09) · GPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install node-multi-storage-local
pnpm add node-multi-storage-local
yarn add node-multi-storage-local
bun add node-multi-storage-local
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2017-03-09 |
| First published | 2016-09-19 |
| Weekly downloads | 0 |
| License | GPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Daniel Wetzel |
| Maintainers | danielkbx |
| Keywords | multi-storage, files, read, get, post |

## Links

- npm: https://www.npmjs.com/package/node-multi-storage-local
- Repository: https://github.com/danielkbx/node-multi-storage-local
- Homepage: https://github.com/danielkbx/node-multi-storage-local#readme
- Issues: https://github.com/danielkbx/node-multi-storage-local/issues
- npm.io page: https://npm.io/package/node-multi-storage-local

## Dependencies (2)

- [mkdirp](https://npm.io/package/mkdirp.md) ^0.5.1
- [underscore](https://npm.io/package/underscore.md) ^1.8.3

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 2.1.0 (latest) — 2017-03-09
- 2.0.1 — 2017-03-02
- 2.0.0 — 2017-02-24
- 1.2.1 — 2016-09-30
- 1.2.0 — 2016-09-22
- 1.0.1 — 2016-09-20
- 1.0.0 — 2016-09-19

## README

# node-multi-storage-local

_node-multi-storage-local_ is a provider for the NodeJS module [node-multi-storage](https://www.npmjs.com/package/node-multi-storage).
It provides saving and reading files to/from the local filesystem.

Since version 2.0 of this module, node-multi-storage v2.0 or newer is needed.

# 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 with 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](https://www.npmjs.com/package/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.
- When calling delete for an URL that does not exist, no error is emitted (since the result is "file does not exist anymore").

---
_Source: https://npm.io/package/node-multi-storage-local · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
