Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

fsdocs

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

fsdocs

manager for saving provided doc to a filesystem

latest
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

FSDocs

A node utility to handle saving text files.

This makes it easier to save text content to disk - for instance when a payload of content in an API request needs to be saved to the server as a static file.

Usage

Instantiate the FSDocs class with the basePath for the save location - must be an absolute path

const FSDocs = require('fsdocs')

const docsManager = new FSDocs('/path/to/save/loation)

Create a file

docsManager.createFile(path, name, ext, content) returns a promise with the absolute path of the created file

await docsManager.createFile('path', 'file-name', '.txt', 'File Content')

Read a file

docsManager.readFile(path) returns a promise with the content of the file

await docsManager.readFile('path/to/file.txt')

Read a directory

docsManager.listFiles(path) returns a promise with an array of filenames

await docsManager.listFiles('path/to/dir')

Update a file

docsManager.updateFile(path, content) returns a promise with the absolute path of the created file

await docsManager.updateFile('path/to/file.txt', 'Updated File Content')

Delete a file

docsManager.deleteFile(path) returns a promise with the absolute path of the deleted file

await docsManager.deleteFile('path/to/file.txt')

API documentation

Read the JSDocs

2020 Adam Davis (ICS)

gi

FAQs

Package last updated on 25 Jan 2020

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