{"_id":"567354bb22cd7e0d00fad9d5","category":{"_id":"5673511f8565060d009a8659","version":"5505855aae827939002fca6e","__v":3,"pages":["5673543422cd7e0d00fad9d1","567354ab8565060d009a8662","567354bb22cd7e0d00fad9d5"],"project":"55058559ae827939002fca6b","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-12-18T00:19:43.941Z","from_sync":false,"order":2,"slug":"dna2json","title":"dna2json"},"project":"55058559ae827939002fca6b","version":{"_id":"5505855aae827939002fca6e","project":"55058559ae827939002fca6b","__v":4,"createdAt":"2015-03-15T13:12:58.366Z","releaseDate":"2015-03-15T13:12:58.366Z","categories":["5505855aae827939002fca6f","5673511f8565060d009a8659","5673512458c4890d00bb54a5","56736118f65d9c0d002e3cb2"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"user":"54ee2c053749bf0d00c7653c","__v":1,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-12-18T00:35:07.538Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"```js\nvar dna = require('dna2json');\nvar fs = require('fs');\n\n// dna.createParser() returns a duplex stream\n// input = text from your dna file\n// output = SNPs as JSON\n// to write to disk just pipe it to JSONStream then to fs\n\nvar txt = fs.readFileSync('dna.txt');\ndna.parse(txt, function(err, snps) {\n  // snps = the object with your mutations\n});\n```","excerpt":"","slug":"module-usage","type":"basic","title":"Module Usage"}
```js var dna = require('dna2json'); var fs = require('fs'); // dna.createParser() returns a duplex stream // input = text from your dna file // output = SNPs as JSON // to write to disk just pipe it to JSONStream then to fs var txt = fs.readFileSync('dna.txt'); dna.parse(txt, function(err, snps) { // snps = the object with your mutations }); ```