Read a pubspec.yaml file
$ npm install read-pubspec
import path from 'path';
import { readPubspec } from 'read-pubspec';
process.chdir(path.join(__dirname, '/test'));
console.log(await readPubspec());
//=> { name: 'root', … }
console.log(await readPubspec({ cwd: path.join(process.cwd(), '/sub') }));
//=> { name: 'sub', … }
Returns a Promise<object>
with the parsed YAML.
Optionally a callback function may be used instead.
Type: object
Type: string
Default: process.cwd()
Current working directory
Type: Function
Optional callback with error as the first argument and the parsed YAML as the second.