Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/heldrida/array-to-txt-file

Takes in an array and will write each value to a text file. Each value is force-converted toString(), and concatenated with a newline.
https://github.com/heldrida/array-to-txt-file

Last synced: about 1 month ago
JSON representation

Takes in an array and will write each value to a text file. Each value is force-converted toString(), and concatenated with a newline.

Awesome Lists containing this project

README

        

# array-to-txt-file

takes in an array and will write each value to a text file.
Each value is force-converted toString(), and concatenated with a newline.
Objects are written via JSON.stringify output.

## Install
$ npm install array-to-txt-file

## Example
```
const arrayToTxtFile = require('array-to-txt-file')

arrayToTxtFile(['Hi there', function add(a,b) {return a+b}, {a: 1, b: 2, c: {d: 3}}], './test-output.txt', err => {
if(err) {
console.error(err)
return
}
console.log('Successfully wrote to txt file')
})
```
```
test-output.txt:

Hi there
function add(a,b) {return a+b}
{"a":1,"b":2,"c":{"d":3}}
```

## Unit tests

$ npm test