Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

support mime type in json

  • Loading branch information...
commit 4147a7127a0fafea25e45fb7c79234b04a10d87e 1 parent 3d81272
omphalos authored

Showing 2 changed files with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. +4 1 crud-file-server.js
  2. +1 1  package.json
5 crud-file-server.js
@@ -143,7 +143,10 @@ exports.handleRequest = function(vpath, path, req, res, readOnly, logHeadRequest
143 143 fs.readFile(relativePath, function(err, data) {
144 144 if(err) { writeError(err); }
145 145 else {
146   - res.end(JSON.stringify({ data: data.toString() }));
  146 + res.end(JSON.stringify({
  147 + data: data.toString(),
  148 + type: require('mime').lookup(relativePath),
  149 + }));
147 150 }
148 151 });
149 152 } else {
2  package.json
... ... @@ -1,6 +1,6 @@
1 1 {
2 2 "name": "crud-file-server",
3   - "version": "0.2.2",
  3 + "version": "0.2.3",
4 4 "description": "file server supporting basic create, read, update, & delete for any kind of file",
5 5 "bin": {
6 6 "crud-file-server": "./bin/crud-file-server"

0 comments on commit 4147a71

Please sign in to comment.
Something went wrong with that request. Please try again.