Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rest-fs

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rest-fs

restful fileserver

  • 0.0.0
  • 0.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
30
increased by15.38%
Maintainers
1
Weekly downloads
 
Created
Source

rest-fs

restful interface to a filesystem

usage

npm start starts fileserver on port 3000

npm test runs various file and folder test

app = require('rest-fs') app is a express application which has all the file system routes defined the app is not in the listening state

API

GET /path/to/dir/

list contents of directory

optional
?recursive = list recursively default false

returns:

  [
    {
      "name" : "file1", // name of dir or file
      "path" : "/path/to/file", // path to dir or file 
      "dir" : false // true if directory
    },
    ...
  ]

GET /path/to/file

returns contents of file
if dir, redirect to dir path

optional
?encoding = default utf8

returns: content of specified file as Content-Type "text/html"

POST /path/to/file/or/dir

creates or overwrites file
creates dir if it does not exist.
renames or moves file if newPath exists

optional
body.newpath = if exist, move/rename file to this location.
body.clobber = if true will overwrite dest files (default false)
body.mkdirp = if true will create path to new location (default false)
body.mode = permissions of file (defaults: file 438(0666) dir 511(0777))
body.encoding = default utf8

returns: nothing

PUT /path/to/file

creates file

optional
body.mode = permissions of file (438 default 0666 octal)
body.encoding = default utf8

returns: nothing

DEL /path/to/dir/

deletes folder
if file returns error

returns: nothing

DEL /path/to/file

deletes file
if folder returns error

returns: nothing

Keywords

FAQs

Package last updated on 07 May 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc