Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

loc-parse.js 583 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  1. const fs = require('fs');
  2. const zlib = require('zlib');
  3. const path = require('path');
  4. const stream = require('stream');
  5. const io = require('./io');
  6. const marc = require('./parse-marc');
  7. let paused = false;
  8. let resumes = [];
  9. function parseFile(fn) {
  10. console.error('parsing file %s', fn);
  11. io.openFile(fn)
  12. .pipe(zlib.createUnzip())
  13. .pipe(marc.parseCollection())
  14. .pipe(new stream.Transform({
  15. objectMode: true,
  16. transform(rec, enc, cb) {
  17. cb(null, JSON.stringify(rec) + '\n');
  18. }
  19. }))
  20. .pipe(process.stdout);
  21. }
  22. parseFile(process.argv[2]);
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...