Skip to content

Commit

Permalink
Merge pull request #37 from marp-team/fix-buffer-deprecation
Browse files Browse the repository at this point in the history
Use Buffer.from() instead of deprecated constructor
  • Loading branch information
yhatt committed Nov 10, 2018
2 parents b205b0b + 018e1c2 commit 4450c89
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Fixed

- Use `Buffer.from()` instead of deprecated constructor ([#37](https://github.com/marp-team/marp-cli/pull/37))

## v0.0.13 - 2018-11-10

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class Converter {
const buffer = await file.load()
const template = await this.convert(buffer!.toString(), file)
const newFile = file.convert(this.options.output, this.options.type)
newFile.buffer = new Buffer(template.result)
newFile.buffer = Buffer.from(template.result)

const result: ConvertResult = { file, newFile, template }
if (this.options.server && opts.initial) return result
Expand Down
4 changes: 3 additions & 1 deletion test/marp-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,9 @@ describe('Marp CLI', () => {
const cliInfo = jest.spyOn(cli, 'info').mockImplementation()
const stdout = jest.spyOn(process.stdout, 'write').mockImplementation()

jest.spyOn(getStdin, 'buffer').mockResolvedValue(new Buffer('# markdown'))
jest
.spyOn(getStdin, 'buffer')
.mockResolvedValue(Buffer.from('# markdown'))

// @ts-ignore: reset cached stdin buffer
File.stdinBuffer = undefined
Expand Down

0 comments on commit 4450c89

Please sign in to comment.