0.1.1 • Published 4 years ago

@l8n/fs v0.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

fs

file handling

Install

npm install @l8n/fs --save-dev
yarn add @l8n/fs --dev

Usage

import { insertLine, removeLine, updateLine, readFile } from '@l8n/fs';

const filename = './test/a.txt';
// insert line: line number optional
// if there is no line number, then the end of the file append.
insertLine(filename, 'test99', 9);

// remove line: exact match
removeLine(filename, 'test99');

// update line: exact match
updateLine(filename, 'old text', 'new text');

// returns array
readFile(filename);