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

@dynamico/fs-storage

Package Overview
Dependencies
Maintainers
3
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dynamico/fs-storage - npm Package Compare versions

Comparing version 0.0.1-alpha.4 to 0.0.1-alpha.5

3

jest.config.js
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node'
testEnvironment: 'node',
coverageDirectory: '../../coverage/fs-storage/'
};
{
"name": "@dynamico/fs-storage",
"version": "0.0.1-alpha.4",
"version": "0.0.1-alpha.5",
"description": "Simple file system implementation as Dynamico storage provider",

@@ -21,3 +21,4 @@ "author": "Soluto",

"scripts": {
"test": "jest --coverage",
"test": "jest",
"coverage": "jest --coverage",
"build": "npm run clean && npm run compile",

@@ -32,3 +33,3 @@ "compile": "tsc",

"dependencies": {
"@dynamico/driver": "^0.0.1-alpha.4",
"@dynamico/driver": "^0.0.1-alpha.5",
"klaw-sync": "^6.0.0",

@@ -48,3 +49,3 @@ "mkdirp": "^0.5.1"

},
"gitHead": "32e2d1a4234394474cf33057ea040bb95a87b649"
"gitHead": "63c3b9c3b430a98e0d2fa630282273f37f423939"
}

@@ -1,11 +0,47 @@

# `fs-storage`
# File system storage
> TODO: description
File system saves components in a specific folder provided in initialization. It uses node file system APIs and needs both read and write permissions as well as permissions to list the folder. Generally this isn't a production grade solution as it's not scalable and should be used mostly when playing around.
## Usage
Let's set up a file system storage provider. It'll take just a few minutes!
__Note:__ this guide assumes you have an express server set up along with the express middleware. If this is not the case refer to our [Getting Started - Backend](../readme.md) guide.
## Getting Started With File System Storage
Let's start by adding the dependency:
```bash
$ npm install @dynamico/fs-storage --save
```
const fsStorage = require('fs-storage');
// TODO: DEMONSTRATE API
Now find the file where you initialized dynamico middleware and add the following `require` statement.
```javascript
const { FSStorage } = require('@dynamico/fs-storage');
```
And initialize the provider and middleware:
```javascript
const storageProvider = new FSStorage('./components');
const dynamicoMiddleware = dynamico(storageProvider);
// Use the middleware
```
And that's it! you now have a server that uses file system to manage dynamic components.
The full code looks something like this:
```javascript
const express = require('express');
const dynamico = require('@dynamico/express-middleware');
const { FSStorage } = require('@dynamico/fs-storage');
const storageProvider = new FSStorage('./components');
const dynamicoMiddleware = dynamico(storageProvider);
const app = express();
app.use('/api/components', dynamico(storageProvider);
app.listen(Number(process.env.PORT || 1234), () => {
console.log(`Listening on port ${process.env.PORT}`);
});
```
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