Skip to content

saintedlama/replace-shebang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

replace-shebang Build Status

Replaces a shebang (eg. #!/bin/sh) by a string using string.replace

Install

$ npm install --save replace-shebang

Usage

const fs = require('fs');
const replaceShebang = require('replace-shebang');

const str = fs.readFileSync('bin', 'utf8');
//=> #!/usr/bin/env node
//=> console.log('unicorns');

// string replacement
replaceShebang(str, '// shebang');
//=> // shebang
//=> console.log('unicorns');

// function to replace the shebang
replaceShebang(str, shebang => '// ' + shebang);
//=> // #!/usr/bin/env node
//=> console.log('unicorns');

// stripping shebangs
replaceShebang(str);
//=> 
//=> console.log('unicorns');

About

Replaces the shebang by some string or nothing

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published