Skip to content

Commit

Permalink
fix: Removes usage of deprecated Buffer constructor. (yarnpkg#5477)
Browse files Browse the repository at this point in the history
  • Loading branch information
ANTOINE DU HAMEL authored and ANTOINE DU HAMEL committed Apr 25, 2018
1 parent cbc6c88 commit bbb13d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/registries/npm-registry.js
Expand Up @@ -338,8 +338,8 @@ export default class NpmRegistry extends Registry {
const username = this.getRegistryOrGlobalOption(registry, 'username');
const password = this.getRegistryOrGlobalOption(registry, '_password');
if (username && password) {
const pw = new Buffer(String(password), 'base64').toString();
return 'Basic ' + new Buffer(String(username) + ':' + pw).toString('base64');
const pw = Buffer.from(String(password), 'base64').toString();
return 'Basic ' + Buffer.from(String(username) + ':' + pw).toString('base64');
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/util/fs.js
Expand Up @@ -767,8 +767,8 @@ export function normalizeOS(body: string): string {
return body.replace(/\r\n/g, '\n');
}

const cr = new Buffer('\r', 'utf8')[0];
const lf = new Buffer('\n', 'utf8')[0];
const cr = '\r'.charCodeAt(0);
const lf = '\n'.charCodeAt(0);
async function getEolFromFile(path: string): Promise<string | void> {
if (!await exists(path)) {
Expand Down

0 comments on commit bbb13d1

Please sign in to comment.