Skip to content

Commit

Permalink
fix: no-wrap option
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Shaw committed Jan 9, 2024
1 parent 370bfc6 commit 75e2d8f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export async function authorize(email, opts = {}) {
* hidden?: boolean
* json?: boolean
* verbose?: boolean
* 'no-wrap'?: boolean
* wrap?: boolean
* 'shard-size'?: number
* 'concurrent-requests'?: number
* }} [opts]
Expand Down Expand Up @@ -120,7 +120,7 @@ export async function upload(firstPath, opts) {
/** @type {(o?: import('@web3-storage/w3up-client/src/types').UploadOptions) => Promise<import('@web3-storage/w3up-client/src/types').AnyLink>} */
const uploadFn = opts?.car
? client.uploadCAR.bind(client, files[0])
: files.length === 1 && opts?.['no-wrap']
: files.length === 1 && opts?.wrap === false
? client.uploadFile.bind(client, files[0])
: client.uploadDirectory.bind(client, files)

Expand All @@ -133,9 +133,9 @@ export async function upload(firstPath, opts) {
' └── '
)}Piece CID: ${piece}`,
})
spinner.start(`Storing ${Math.round((totalSent / totalSize) * 100)}%`)
spinner.start(`Storing ${Math.min(Math.round((totalSent / totalSize) * 100), 100)}%`)
} else {
spinner.text = `Storing ${Math.round((totalSent / totalSize) * 100)}%`
spinner.text = `Storing ${Math.min(Math.round((totalSent / totalSize) * 100), 100)}%`
}
opts?.json &&
opts?.verbose &&
Expand Down

0 comments on commit 75e2d8f

Please sign in to comment.