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

test-parse.js 559 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
  1. let fs = require('fs-extra');
  2. let zlib = require('zlib');
  3. let marc = require('./lib/parse-marc');
  4. let miss = require('mississippi');
  5. let start = process.hrtime();
  6. let n = 0;
  7. fs.createReadStream('data/LOC/BooksAll.2014.part01.xml.gz')
  8. .pipe(zlib.createGunzip())
  9. .pipe(marc.parseEntries())
  10. .pipe(miss.to.obj((rec, enc, cb) => {
  11. n += 1;
  12. if (n % 500 == 0) {
  13. let [es, ems] = process.hrtime(start);
  14. let t = es + ems * 1e-9;
  15. let rate = n / t;
  16. console.log('parsed %d at %s r/s', n, rate.toPrecision(5));
  17. }
  18. cb();
  19. }));
Tip!

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

Comments

Loading...