Compare commits
No commits in common. "v0.2.0-develop.28" and "v0.2.0-develop.27" have entirely different histories.
v0.2.0-dev
...
v0.2.0-dev
|
@ -1,5 +1,3 @@
|
||||||
# [0.2.0-develop.28](https://git.lumeweb.com/LumeWeb/libportal/compare/v0.2.0-develop.27...v0.2.0-develop.28) (2023-09-07)
|
|
||||||
|
|
||||||
# [0.2.0-develop.27](https://git.lumeweb.com/LumeWeb/libportal/compare/v0.2.0-develop.26...v0.2.0-develop.27) (2023-09-07)
|
# [0.2.0-develop.27](https://git.lumeweb.com/LumeWeb/libportal/compare/v0.2.0-develop.26...v0.2.0-develop.27) (2023-09-07)
|
||||||
|
|
||||||
# [0.2.0-develop.26](https://git.lumeweb.com/LumeWeb/libportal/compare/v0.2.0-develop.25...v0.2.0-develop.26) (2023-09-07)
|
# [0.2.0-develop.26](https://git.lumeweb.com/LumeWeb/libportal/compare/v0.2.0-develop.25...v0.2.0-develop.26) (2023-09-07)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/libportal",
|
"name": "@lumeweb/libportal",
|
||||||
"version": "0.2.0-develop.28",
|
"version": "0.2.0-develop.27",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lumeweb/libportal",
|
"name": "@lumeweb/libportal",
|
||||||
"version": "0.2.0-develop.28",
|
"version": "0.2.0-develop.27",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@lumeweb/libs5": "^0.1.0-develop.50",
|
"@lumeweb/libs5": "^0.1.0-develop.50",
|
||||||
"@noble/curves": "^1.1.0",
|
"@noble/curves": "^1.1.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/libportal",
|
"name": "@lumeweb/libportal",
|
||||||
"version": "0.2.0-develop.28",
|
"version": "0.2.0-develop.27",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -288,19 +288,23 @@ export class Client {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async uploadFile(stream: Blob, size?: bigint): Promise<CID>;
|
async uploadFile(stream: Blob, size?: bigint): Promise<string>;
|
||||||
async uploadFile(
|
async uploadFile(
|
||||||
stream: ReadableStream,
|
stream: ReadableStream,
|
||||||
hashStream: ReadableStream,
|
hashStream: ReadableStream,
|
||||||
size: bigint,
|
size: bigint,
|
||||||
): Promise<CID>;
|
): Promise<string>;
|
||||||
async uploadFile(stream: Uint8Array, size?: bigint): Promise<CID>;
|
async uploadFile(stream: Uint8Array, size?: bigint): Promise<string>;
|
||||||
async uploadFile(
|
async uploadFile(
|
||||||
stream: NodeJS.ReadableStream,
|
stream: NodeJS.ReadableStream,
|
||||||
hashStream: NodeJS.ReadableStream,
|
hashStream: NodeJS.ReadableStream,
|
||||||
size?: bigint,
|
size?: bigint,
|
||||||
): Promise<CID>;
|
): Promise<string>;
|
||||||
async uploadFile(stream: any, hashStream?: any, size?: bigint): Promise<CID> {
|
async uploadFile(
|
||||||
|
stream: any,
|
||||||
|
hashStream?: any,
|
||||||
|
size?: bigint,
|
||||||
|
): Promise<string> {
|
||||||
const Blob = await this.getBlobObject();
|
const Blob = await this.getBlobObject();
|
||||||
|
|
||||||
if (stream instanceof Uint8Array || stream instanceof Blob) {
|
if (stream instanceof Uint8Array || stream instanceof Blob) {
|
||||||
|
@ -320,14 +324,14 @@ export class Client {
|
||||||
return this.uploadFileTus(stream, hashStream, size);
|
return this.uploadFileTus(stream, hashStream, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async uploadFileSmall(stream: Blob): Promise<CID>;
|
private async uploadFileSmall(stream: Blob): Promise<string>;
|
||||||
private async uploadFileSmall(
|
private async uploadFileSmall(
|
||||||
stream: ReadableStream,
|
stream: ReadableStream,
|
||||||
hashStream: ReadableStream,
|
hashStream: ReadableStream,
|
||||||
): Promise<CID>;
|
): Promise<string>;
|
||||||
private async uploadFileSmall(stream: Uint8Array): Promise<CID>;
|
private async uploadFileSmall(stream: Uint8Array): Promise<string>;
|
||||||
private async uploadFileSmall(stream: NodeJS.ReadableStream): Promise<CID>;
|
private async uploadFileSmall(stream: NodeJS.ReadableStream): Promise<string>;
|
||||||
private async uploadFileSmall(stream: any): Promise<CID> {
|
private async uploadFileSmall(stream: any): Promise<string> {
|
||||||
const Blob = await this.getBlobObject();
|
const Blob = await this.getBlobObject();
|
||||||
|
|
||||||
if (stream instanceof ReadableStream) {
|
if (stream instanceof ReadableStream) {
|
||||||
|
@ -369,26 +373,29 @@ export class Client {
|
||||||
{ auth: true },
|
{ auth: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
return CID.decode(response.cid);
|
return response.cid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async uploadFileTus(stream: Blob, size?: bigint): Promise<CID>;
|
private async uploadFileTus(stream: Blob, size?: bigint): Promise<string>;
|
||||||
private async uploadFileTus(
|
private async uploadFileTus(
|
||||||
stream: ReadableStream,
|
stream: ReadableStream,
|
||||||
hashStream: ReadableStream,
|
hashStream: ReadableStream,
|
||||||
size?: bigint,
|
size?: bigint,
|
||||||
): Promise<CID>;
|
): Promise<string>;
|
||||||
private async uploadFileTus(stream: Uint8Array, size?: bigint): Promise<CID>;
|
private async uploadFileTus(
|
||||||
|
stream: Uint8Array,
|
||||||
|
size?: bigint,
|
||||||
|
): Promise<string>;
|
||||||
private async uploadFileTus(
|
private async uploadFileTus(
|
||||||
stream: NodeJS.ReadableStream,
|
stream: NodeJS.ReadableStream,
|
||||||
hashStream: ReadableStream,
|
hashStream: ReadableStream,
|
||||||
size?: bigint,
|
size?: bigint,
|
||||||
): Promise<CID>;
|
): Promise<string>;
|
||||||
private async uploadFileTus(
|
private async uploadFileTus(
|
||||||
stream: any,
|
stream: any,
|
||||||
hashStream?: any,
|
hashStream?: any,
|
||||||
size?: bigint,
|
size?: bigint,
|
||||||
): Promise<CID> {
|
): Promise<string> {
|
||||||
if (["bigint", "number"].includes(typeof hashStream)) {
|
if (["bigint", "number"].includes(typeof hashStream)) {
|
||||||
size = BigInt(hashStream);
|
size = BigInt(hashStream);
|
||||||
hashStream = undefined;
|
hashStream = undefined;
|
||||||
|
@ -476,7 +483,7 @@ export class Client {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return cid;
|
return cid.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getUploadStatus(cid: string) {
|
async getUploadStatus(cid: string) {
|
||||||
|
|
Loading…
Reference in New Issue