Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions packages/filesystem-access/src/downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,37 @@ import { FileMeta } from "./filemeta"
export interface Downloader {
readonly public: boolean

getLocation(): Promise<Uint8Array>
getEncryptionKey(): Promise<Uint8Array | undefined>
getLocation?(): Promise<Uint8Array>
getEncryptionKey?(): Promise<Uint8Array | undefined>

readonly cancelled: boolean
readonly errored: boolean
readonly started: boolean
readonly done: boolean
readonly paused: boolean
readonly cancelled?: boolean
readonly errored?: boolean
readonly started?: boolean
readonly done?: boolean
readonly paused?: boolean

readonly name: string
readonly name?: string

readonly size: number | undefined
readonly sizeOnFS: number | undefined
readonly size?: number | undefined
readonly sizeOnFS?: number | undefined

getDownloadUrl(): Promise<string | undefined>
getMetadata(): Promise<FileMeta | undefined>
getDownloadUrl?(): Promise<string | undefined>
getMetadata?(): Promise<FileMeta | undefined>

readonly output: ReadableStream<Uint8Array> | undefined
readonly output?: ReadableStream<Uint8Array> | undefined

readonly startTime: number | undefined
readonly endTime: number | undefined
readonly pauseDuration: number
readonly startTime?: number | undefined
readonly endTime?: number | undefined
readonly pauseDuration?: number

_beforeDownload?: (d: this) => Promise<void>
_afterDownload?: (d: this) => Promise<void>

pause(): Promise<void>
unpause(): Promise<void>
pause?(): Promise<void>
unpause?(): Promise<void>

start(): Promise<ReadableStream<Uint8Array> | undefined>
finish(): Promise<void>
start?(): Promise<ReadableStream<Uint8Array> | undefined>
finish?(): Promise<void>

cancel(): Promise<void>
cancel?(): Promise<void>
}
42 changes: 21 additions & 21 deletions packages/filesystem-access/src/uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,36 @@ import { FileMeta } from "./filemeta"
export interface Uploader {
readonly public: boolean

getLocation(): Promise<Uint8Array>
getEncryptionKey(): Promise<Uint8Array | undefined>
getLocation?(): Promise<Uint8Array>
getEncryptionKey?(): Promise<Uint8Array | undefined>

readonly cancelled: boolean
readonly errored: boolean
readonly started: boolean
readonly done: boolean
readonly paused: boolean
readonly cancelled?: boolean
readonly errored?: boolean
readonly started?: boolean
readonly done?: boolean
readonly paused?: boolean

readonly name: string
readonly path: string
readonly metadata: FileMeta
readonly name?: string
readonly path?: string
readonly metadata?: FileMeta

readonly size: number
readonly sizeOnFS: number
readonly size?: number
readonly sizeOnFS?: number

readonly output: TransformStream<Uint8Array, Uint8Array> | undefined
readonly output?: TransformStream<Uint8Array, Uint8Array> | undefined

readonly startTime: number | undefined
readonly endTime: number | undefined
readonly pauseDuration: number
readonly startTime?: number | undefined
readonly endTime?: number | undefined
readonly pauseDuration?: number

_beforeUpload?: (u: this) => Promise<void>
_afterUpload?: (u: this) => Promise<void>

pause(): Promise<void>
unpause(): Promise<void>
pause?(): Promise<void>
unpause?(): Promise<void>

start(): Promise<TransformStream<Uint8Array, Uint8Array> | undefined>
finish(): Promise<void>
start?(): Promise<TransformStream<Uint8Array, Uint8Array> | undefined>
finish?(): Promise<void>

cancel(): Promise<void>
cancel?(): Promise<void>
}
2 changes: 1 addition & 1 deletion packages/opaque/src/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export class OpaqueDownload extends EventTarget implements Downloader, IDownload
})
}

async getMetadata (): Promise<FileMeta | undefined> {
async getMetadata (): Promise<FileMeta | any> {
return this._m.runExclusive(async () => {
if (this._fileMeta) {
return this._fileMeta
Expand Down
22 changes: 22 additions & 0 deletions packages/sia/fuse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { fusebox, pluginReplace } from "fuse-box"

const fuse = fusebox({
target: "browser",
entry: "src/index.ts",
webIndex: {
template: "src/index.html",
},
devServer: true,
sourceMap: true,
hmr: false,
plugins: [
pluginReplace(/node_modules\/bn\.js\/.*/, {
"require('buffer')": "require('" + require.resolve("./node_modules/buffer") + "')",
}),
pluginReplace(/node_modules\/readable-stream\/.*/, {
"require('util')": "require('" + require.resolve("./node_modules/util") + "')",
}),
],
})

fuse.runDev()
37 changes: 37 additions & 0 deletions packages/sia/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "@opacity/sia",
"version": "0.0.1",
"description": "> TODO: description",
"author": "Khoa <[email protected]>",
"homepage": "https://github.com/opacity/ts-client-library#readme",
"main": "src/index.ts",
"directories": {
"lib": "src"
},
"files": [
"src"
],
"repository": {
"type": "git",
"url": "git+https://github.com/opacity/ts-client-library.git"
},
"bugs": {
"url": "https://github.com/opacity/ts-client-library/issues"
},
"scripts": {
"start": "rm -rf ./.cache && rm -rf ./dist && npx ts-node --project ./config/tsconfig.dev.json fuse.ts",
"pretty": "prettierx --ignore-path ./config/.prettierxignore --config ./config/.prettierx.config.json --write .",
"test": "echo \"Error: run tests from root\" && exit 1"
},
"dependencies": {
"@opacity/account-system": "^0.0.46",
"@opacity/filesystem-access": "^0.0.46",
"@opacity/middleware": "^0.0.46",
"@opacity/util": "^0.0.46",
"async-mutex": "^0.2.6",
"buffer": "^6.0.3",
"tslib": "^2.1.0",
"util": "^0.12.3",
"web-streams-polyfill": "^3.0.1"
}
}
Loading