mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-08-25 08:08:00 +00:00
1ada95e04a
- Convert project to Javascript/Typescript - Allow custom headers to be passed in (optional) - Allow body to be optional
12 lines
422 B
JavaScript
12 lines
422 B
JavaScript
'use strict';
|
|
const path = require('path');
|
|
const fs = require('graceful-fs');
|
|
const stripBom = require('strip-bom');
|
|
const parseJson = require('parse-json');
|
|
const pify = require('pify');
|
|
|
|
const parse = (data, fp) => parseJson(stripBom(data), path.relative('.', fp));
|
|
|
|
module.exports = fp => pify(fs.readFile)(fp, 'utf8').then(data => parse(data, fp));
|
|
module.exports.sync = fp => parse(fs.readFileSync(fp, 'utf8'), fp);
|