file-firstline-replace
Version:
Replace the first line of a file with something else.
22 lines (17 loc) • 547 B
Markdown
Replace the first line of a file with something else.
If you need to replace the first line in a file, this module will allow you to do that. Particularly built for CSVs, https://github.com/madwire-media/lets-make-csvs, but you can use it for anything.
```bash
npm install file-firstline-replace
```
```javascript
var filename = "thing.csv"
var newHeader = `"foo","bar","baz","bang"`
replaceFirstLineOfFile(filename, newHeader, function(err) {
if (err) throw err
/* ... */
})
```