Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@yarnpkg/lockfile

yarnpkg25.1mBSD-2-Clause1.1.0TypeScript support: definitely-typed

The parser/stringifier for Yarn lockfiles.

yarn, yarnpkg, lockfile, dependency, npm

readme

yarn-lockfile

Parse and/or write yarn.lock files

Usage Examples

const fs = require('fs');
const lockfile = require('@yarnpkg/lockfile');
// or (es6)
import fs from 'fs';
import * as lockfile from '@yarnpkg/lockfile';

let file = fs.readFileSync('yarn.lock', 'utf8');
let json = lockfile.parse(file);

console.log(json);

let fileAgain = lockfile.stringify(json);

console.log(fileAgain);