New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fscs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fscs - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

2

package.json
{
"name": "fscs",
"version": "0.1.0",
"version": "0.2.0",
"description": "File System CRUD Server",

@@ -5,0 +5,0 @@ "main": "./src/server.js",

@@ -1,2 +0,2 @@

# fscs · [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/elisherer/fscs/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/fscs.svg?style=flat)](https://www.npmjs.com/package/fscs) ![Tests Status](https://github.com/elisherer/fcsc/workflows/test/badge.svg) ![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)
# fscs · [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/elisherer/fscs/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/fscs.svg?style=flat)](https://www.npmjs.com/package/fscs) ![Build and Test](https://github.com/elisherer/fscs/workflows/Build%20and%20Test/badge.svg) ![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)

@@ -121,2 +121,2 @@ File System CRUD server

fscs is [MIT Licensed](https://github.com/elisherer/fscs/blob/master/LICENSE)
fscs is [MIT Licensed](https://github.com/elisherer/fscs/blob/master/LICENSE)
module.exports = ctx => {
const { res } = ctx;
const { req, res } = ctx;
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader("Access-Control-Allow-Headers", "Authorization,Content-Type");
res.setHeader("Access-Control-Allow-Headers", "Authorization,Content-Type,If-Modified-Since");
res.setHeader("Access-Control-Allow-Methods", "GET,POST,PATCH,PUT,DELETE,OPTIONS");
if (req.method === 'OPTIONS') {
res.statusCode = 200;
res.end();
return true;
}
};

@@ -140,10 +140,15 @@ const fs = require("fs");

const stream = fs.createWriteStream(filePath);
req.pipe(stream); // TODO: limit data length?
stream.on("end", function () {
res.statusCode = 204;
res.end();
let failed = false;
stream.on("close", function () {
if (!failed) {
res.statusCode = 204;
res.end();
}
});
stream.on("error", err => {
throw err;
failed = true;
console.error(err);
new HTTPResponseError(500).process(res);
});
req.pipe(stream);
return;

@@ -150,0 +155,0 @@ }

@@ -27,3 +27,3 @@ const crypto = require("crypto");

if (options.verbose) logger(ctx);
if (options.cors) cors(ctx);
if (options.cors && cors(ctx)) return;
if (!options.public) auth(ctx);

@@ -30,0 +30,0 @@ if (_static(ctx)) return;

Sorry, the diff of this file is not supported yet

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