Skip to content

Commit

Permalink
Merge pull request #195 from atonoy/hotfix/no-work-arrayBuffer-nft.st…
Browse files Browse the repository at this point in the history
…roage

Hotfix/no work array buffer nft.stroage
  • Loading branch information
fukaoi authored Oct 30, 2023
2 parents 3feb15e + 5c47cd7 commit f05b9f6
Show file tree
Hide file tree
Showing 8 changed files with 2,637 additions and 880 deletions.
2 changes: 1 addition & 1 deletion packages/storage/dist/cjs/nft-storage.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/storage/dist/cjs/nft-storage.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/storage/dist/cjs/nft-storage.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/storage/dist/esm/nft-storage.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/storage/dist/esm/nft-storage.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/storage/dist/esm/nft-storage.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 9 additions & 3 deletions packages/storage/src/nft-storage.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { Blob, NFTStorage } from 'nft.storage';
import { Constants, debugLog, Result, Try } from '@solana-suite/shared';
import {
Constants,
debugLog,
isBrowser,

Check warning on line 5 in packages/storage/src/nft-storage.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

'isBrowser' is defined but never used
isNode,

Check warning on line 6 in packages/storage/src/nft-storage.ts

View workflow job for this annotation

GitHub Actions / build (18.x)

'isNode' is defined but never used
Result,
Try,
} from '@solana-suite/shared';
import { ProvenanceLayer } from './provenance-layer';
import { FileContent, InfraSideInput } from '@solana-suite/shared-metaplex';

Expand Down Expand Up @@ -42,9 +49,8 @@ export namespace NftStorage {
} else if (ProvenanceLayer.isBrowserable(filePath)) {
file = Buffer.from(await filePath.arrayBuffer());
} else {
throw Error('Supported environment: only Node.js and Browser js');
file = Buffer.from(filePath as ArrayBuffer);
}

const blobImage = new Blob([file]);
const res = await connect().storeBlob(blobImage);
return createGatewayUrl(res);
Expand Down
Loading

0 comments on commit f05b9f6

Please sign in to comment.