Skip to content

Commit

Permalink
Import buffer from npm modules explicitly
Browse files Browse the repository at this point in the history
The official docs (https://github.com/feross/buffer) suggest:

> To depend on this module explicitly (without browserify), require it like
> this:
>     var Buffer = require('buffer/').Buffer  // note: the trailing slash is important!
> To require this module explicitly, use require('buffer/') which tells the
> node.js module lookup algorithm (also used by browserify) to use the npm
> module named buffer instead of the node.js core module named buffer!
  • Loading branch information
korya committed Oct 24, 2023
1 parent 2b637db commit 2a8270a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tar-extractor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import RNFS from 'react-native-fs';
import { Buffer } from 'buffer';
// The official docs suggest to import it with a trailing slash:
// > To depend on this module explicitly (without browserify), require it like
// > this:
// > var Buffer = require('buffer/').Buffer // note: the trailing slash is important!
// > To require this module explicitly, use require('buffer/') which tells the
// > node.js module lookup algorithm (also used by browserify) to use the npm
// > module named buffer instead of the node.js core module named buffer!
import { Buffer } from 'buffer/';

type LogLevel = '' | 'debug' | 'trace';

Expand Down

0 comments on commit 2a8270a

Please sign in to comment.