# angular-filemanager-nodejs-bridge

> Node.js bridge for angular-filemanager

Latest version **0.1.3** (published 2016-02-24) · AGPL-3.0 license · 0 weekly downloads

## Install

```sh
npm install angular-filemanager-nodejs-bridge
pnpm add angular-filemanager-nodejs-bridge
yarn add angular-filemanager-nodejs-bridge
bun add angular-filemanager-nodejs-bridge
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2016-02-24 |
| First published | 2016-02-19 |
| Weekly downloads | 0 |
| License | AGPL-3.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Known vulnerabilities | 0 (+11 in 1 direct dependencies) |
| Install scripts | no |
| Author | Fabian Köster |
| Maintainers | maestro_alubia |

## Links

- npm: https://www.npmjs.com/package/angular-filemanager-nodejs-bridge
- npm.io page: https://npm.io/package/angular-filemanager-nodejs-bridge

## Dependencies (10)

- [cors](https://npm.io/package/cors.md) ^2.7.1
- [mime](https://npm.io/package/mime.md) ^1.3.4
- [morgan](https://npm.io/package/morgan.md) ^1.6.1
- [multer](https://npm.io/package/multer.md) ^1.1.0
- [express](https://npm.io/package/express.md) ^4.13.4
- [bluebird](https://npm.io/package/bluebird.md) ^3.3.1
- [fs.extra](https://npm.io/package/fs.extra.md) ^1.3.2
- [body-parser](https://npm.io/package/body-parser.md) ^1.15.0
- [compression](https://npm.io/package/compression.md) ^1.6.1
- [connect-timeout](https://npm.io/package/connect-timeout.md) ^1.7.0

## Recent versions

- 0.1.3 (latest) — 2016-02-24
- 0.1.2 — 2016-02-22
- 0.1.1 — 2016-02-19
- 0.1.0 — 2016-02-19

## README

# angular-filemanager-nodejs-bridge

This project provides a backend for the fantastic [angular-filemanager](https://github.com/joni2back/angular-filemanager/) UI written with [Node.js](https://nodejs.org/) and [Express](http://expressjs.com/).

**CAUTION: This project is a work in progress!**

## Features

Currently the following operations are (partially) implemented:

* [Listing](https://github.com/joni2back/angular-filemanager/blob/master/API.md#listing-url-filemanagerconfiglisturl-method-post)
* [Rename/Move](https://github.com/joni2back/angular-filemanager/blob/master/API.md#rename--move-url-filemanagerconfigrenameurl-method-post)
* [Copy](https://github.com/joni2back/angular-filemanager/blob/master/API.md#copy-url-filemanagerconfigcopyurl-method-post)
* [Remove](https://github.com/joni2back/angular-filemanager/blob/master/API.md#remove-url-filemanagerconfigremoveurl-method-post)
* [Create folder](https://github.com/joni2back/angular-filemanager/blob/master/API.md#create-folder-url-filemanagerconfigcreatefolderurl-method-post)
* [Upload file](https://github.com/joni2back/angular-filemanager/blob/master/API.md#upload-file-url-filemanagerconfiguploadurl-method-post-content-type-multipartform-data)
* [Download/Preview](https://github.com/joni2back/angular-filemanager/blob/master/API.md#download--preview-file-url-filemanagerconfigdownloadfileurl-method-get)

## TODO

* Proper error handling
* Security: Ensure users cannot access paths they are not allowed to access (e.g. passing "../../" as path)
* Missing API functions
  * [Edit file](https://github.com/joni2back/angular-filemanager/blob/master/API.md#edit-file-url-filemanagerconfigediturl-method-post)
  * [Get content of a file](https://github.com/joni2back/angular-filemanager/blob/master/API.md#get-content-of-a-file-url-filemanagerconfiggetcontenturl-method-post)
  * [Set permissions](https://github.com/joni2back/angular-filemanager/blob/master/API.md#set-permissions-url-filemanagerconfigpermissionsurl-method-post)
  * [Compress file](https://github.com/joni2back/angular-filemanager/blob/master/API.md#compress-file-url-filemanagerconfigcompressurl-method-post)
  * [Extract file](https://github.com/joni2back/angular-filemanager/blob/master/API.md#extract-file-url-filemanagerconfigextracturl-method-post)
* Implement new API for [click-changes branch of angular-filemanager](https://github.com/joni2back/angular-filemanager/tree/click-changes).

## Usage (standalone)

1. Checkout this Git repository:

  ```
  git clone https://github.com/fkoester/angular-filemanager-nodejs-bridge.git
  ```
2. Install dependencies:

  ```
  npm install
  ```
3. run

  ```
  DATA_DIR=/tmp npm start
  ```
  *Change DATA_DIR variable to the root folder you want angular-filemanager to operate on*
4. Configure angular-filemanager in your angular app:

  ```
  app.config(function (fileManagerConfigProvider) {
    var defaults = fileManagerConfigProvider.$get();

    fileManagerConfigProvider.set({
      listUrl: 'http://localhost:5000/list',
      downloadFileUrl: 'http://localhost:5000/download',
      uploadUrl: 'http://localhost:5000/upload',
      removeUrl: 'http://localhost:5000/remove',
      createFolderUrl: 'http://localhost:5000/createFolder',
      renameUrl: 'http://localhost:5000/rename',
      copyUrl: 'http://localhost:5000/copy'
    });
  });
  ```

### Using Docker
You can also run this server via [Docker](https://www.docker.com/) using the image [maestroalubia/angular-filemanager-nodejs-bridge](https://hub.docker.com/r/maestroalubia/angular-filemanager-nodejs-bridge/).

The easiest way to get it up running is using [docker-compose](https://docs.docker.com/compose/), just run `docker-compose up` in the project root. This exports the host's `/tmp` directory. You can change this by changing the `docker-compose.yml` file.

## Usage (in other express application)

If you want to integrate this bridge into your own Express application you can do so by adding it as a dependency:

1. Install via npm

   ```
   npm install --save angular-filemanager-nodejs-bridge
   ```

2. Import and configure the router

   ```
   const express = require('express');
   const filesRouter = require('angular-filemanager-nodejs-bridge').router;
   const routes = express.Router();

   routes.use('/files', filesRouter);
   ```
3. Configure a custom base dir function (optional)

  ```
  const pathresolver = require('angular-filemanager-nodejs-bridge').pathresolver;

  pathresolver.baseDir = function(req) {

    if(req.body.username = 'foo') {
      return '/foo';
    }

    return '/bar';
  };
  ```

---
_Source: https://npm.io/package/angular-filemanager-nodejs-bridge · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
