Skip to content

Commit

Permalink
Buffer is not available in browsers, so add a guard against that. Als…
Browse files Browse the repository at this point in the history
…o bump the version number again
  • Loading branch information
ChrisMBarr committed Aug 30, 2023
1 parent ad382a2 commit 989b3f5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "songshowplus-parser",
"version": "2.0.3",
"version": "2.0.4",
"description": "Parses and extracts data from SongShow Plus files",
"main": "dist/main/index.js",
"typings": "dist/main/index.d.ts",
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ export class SongShowPlus {
public parse(rawBuffer: Buffer | ArrayBuffer | ArrayBufferLike): SongShowPlusSong {
// console.log('==========================================================');
let fileBuffer: ArrayBuffer;
if (Buffer.isBuffer(rawBuffer)) {
//The Node Buffer is not available in web browsers, so we want to make sure it exists before attempting to use it
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(rawBuffer)) {
//Convert Node Buffer to an array buffer
//https://stackoverflow.com/a/71211814/79677
fileBuffer = rawBuffer.buffer.slice(
Expand Down

0 comments on commit 989b3f5

Please sign in to comment.