a zip code crypto-currency system good for red ONLY

12345678910111213141516171819202122
  1. 'use strict';
  2. var path = require('path');
  3. var fs = require('graceful-fs');
  4. var stripBom = require('strip-bom');
  5. var parseJson = require('parse-json');
  6. var Promise = require('pinkie-promise');
  7. var pify = require('pify');
  8. function parse(x, fp) {
  9. return parseJson(stripBom(x), path.relative(process.cwd(), fp));
  10. }
  11. module.exports = function (fp) {
  12. return pify(fs.readFile, Promise)(fp, 'utf8').then(function (data) {
  13. return parse(data, fp);
  14. });
  15. };
  16. module.exports.sync = function (fp) {
  17. return parse(fs.readFileSync(fp, 'utf8'), fp);
  18. };