Code Monkey home page Code Monkey logo

crud-file-server's Introduction

build status crud-file-server

This package exposes a directory and its children to create, read, update, and delete operations over http.

Command-line usage

 crud-file-server [options]

This starts a file server using the specified command-line options.

-f file system path to expose over http
-h log head requests
-p port to listen on (example, 80)
-q suppress this message
-r read only
-v virtual path to host the file server on	

Example:

crud-file-server -f c:/ -p 8080 -q -v filez	

Supported operations

GET returns a file's contents with the correct mime type, or else the contents of a directory as html.

GET http://localhost?type=json formats content as json instead of the default type. This works for directories and files.

HEAD is the same as a GET, omitting the body.

PUT can be used to write a file.

DELETE can be used to delete a file or folder.

POST supports two operations, rename and create directory.

POST http://localhost/newDir?create=directory would create a directory named newDir.

POST http://localhost/abc.html?rename=def.html would rename abc.html to def.html.

Run the Example

For further clarification, try running the example.

npm install crud-file-server

Navigate to the example directory (which should now be under node_modules/crud-file-server/example).

cd node_modules/crud-file-server/example

Run crud-file-server to host the current directory.

crud-file-server -p 3300

Now use your browser to navigate to http://localhost:3300/example.html.
You will see a simple client that lets you interact with your file system from the web browser.

crud-file-server's People

Contributors

omphalos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

crud-file-server's Issues

Security issue

Hi,

I'm a member of the Node.js Security WG and we received a report regarding a security issue with this module.

We tried inviting the author by e-mail but received no response so I'm opening this issue and inviting anyone with commit and npm publish rights to collaborate with us on a fix.

No such file or directory

I'm new to node so this could be simple, whatever I try (-p -f etc. etc.) I get:
./crud-file-server
: No such file or directory
This example is running straight from bin
Thanks in advance Hugh Barnard

Cannot put image or video.

Hi!

when i put image or video, upload request get success message.
But, i cannot open image and video file.

At the front of the file, "------WebKitFormBoundaryBzJeS8LNmkg6mBDY
Content-Disposition: form-data; name=""; filename="Ronno2.PNG"
Content-Type: image/png" this kinds of text exists.

Unable to access files with white space in the name

Hi omphalos,

I am unable to access files with white space in the file name. For example, when accessing file name , the browser goes to http://127.0.0.1:3030/file%20name and return error message {"errno":34,"code":"ENOENT","path":"/home/ubuntu/shared/file%20name"}

Any help?

Thanks,
Daniel

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.