Skip to content

jeromedecoster/cp-funcs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cp-funcs

A very limited subset of cp functions I use every day

Install

npm i cp-funcs

Package on npm

API


exec-file(file, [args], [options])

Execute the file

Argument Action
file the executed file
args the list of string arguments
options optional options, default to { maxBuffer: 20971520 }

args can be an Array or a String

The default maxBuffer is 20 Mo instead of 200 ko

result is an object with two properties { stdout, stderr }

The EOF chars \n or \r\n are removed from the returned strings stdout and stderr

const execfile = require('cp-funcs/exec-file')

execfile('echo', ['one', 'two']).then(result => {
  // one two
  console.log(result.stdout)
})

execfile('echo', 'abc def').then(result => {
  // abc def
  console.log(result.stdout)
})

exec(command, [options])

Execute the command

Argument Action
command the executed command
options optional options, default to { maxBuffer: 20971520 }

The default maxBuffer is 20 Mo instead of 200 ko

result is an object with two properties { stdout, stderr }

The EOF chars \n or \r\n are removed from the returned strings stdout and stderr

const exec = require('cp-funcs/exec')

exec('echo one two').then(result => {
  // one two
  console.log(result.stdout)
})

License

MIT

About

A very limited subset of cp functions I use every day

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published