@avanio/os-api-linux-utils
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

@avanio/os-api-linux-utils

This package provides file utilities for reading, writing, and deleting files on Linux. It also includes the option to perform these operations with sudo privileges.

Installation

To install this package, run the following command:

npm install @avanio/os-api-linux-utils

Usage

// read file
const data: Buffer = readFile('/path/to/file', {sudo: true});
const data: Buffer = await readFilePromise('/path/to/file', {sudo: true});

// write file
writeFile('/path/to/file', Buffer.from('data'), {sudo: true});
await writeFilePromise('/path/to/file', Buffer.from('data'), {sudo: true});

// delete file
deleteFile('/path/to/file', {sudo: true});
await deleteFilePromise('/path/to/file', {sudo: true});

// logging sudo commands
setSudoFileLogger(console); // or log4js or winston or any ILoggerLike object

Readme

Keywords

none

Package Sidebar

Install

npm i @avanio/os-api-linux-utils

Weekly Downloads

2

Version

0.1.1

License

ISC

Unpacked Size

73.3 kB

Total Files

46

Last publish

Collaborators

  • samutoljamo
  • olliglorioso
  • mharj