Skip to content

Commit

Permalink
docs(csv-issues-esm): prepend data to stream (fix #347)
Browse files Browse the repository at this point in the history
  • Loading branch information
wdavidw committed Jun 27, 2022
1 parent fcd8ac5 commit bfc44a0
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions demo/issues-esm/lib/347.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

import fs from 'fs'
import { stringify } from 'csv-stringify';
import { generate } from 'csv-generate';

// Write stream initialisation
const ws = fs.createWriteStream('/tmp/a_test')
// Write some metadata
ws.write('---\n')
ws.write('propery: My Value\n')
ws.write('---\n')

generate({
length: 20,
objectMode: true,
seed: 1,
headers: 2,
duration: 400
})
.pipe(stringify({
header: true,
columns: {
year: 'birthYear',
phone: 'phone'
}
}))
.pipe(ws);

0 comments on commit bfc44a0

Please sign in to comment.