Bluesky app fork with some witchin' additions 馃挮 witchsky.app
bluesky fork client
117
fork

Configure Feed

Select the types of activity you want to include in your feed.

at d42a2808ba53a049fc38f559feeddaa5a335f93f 29 lines 864 B view raw
1import {type BskyAgent, type ComAtprotoRepoUploadBlob} from '@atproto/api' 2 3/** 4 * @note It is recommended, on web, to use the `file` instance of the file 5 * selector input element, rather than a `data:` URL, to avoid 6 * loading the file into memory. `File` extends `Blob` "file" instances can 7 * be passed directly to this function. 8 */ 9export async function uploadBlob( 10 agent: BskyAgent, 11 input: string | Blob, 12 encoding?: string, 13): Promise<ComAtprotoRepoUploadBlob.Response> { 14 if ( 15 typeof input === 'string' && 16 (input.startsWith('data:') || input.startsWith('blob:')) 17 ) { 18 const blob = await fetch(input).then(r => r.blob()) 19 return agent.uploadBlob(blob, {encoding}) 20 } 21 22 if (input instanceof Blob) { 23 return agent.uploadBlob(input, { 24 encoding, 25 }) 26 } 27 28 throw new TypeError(`Invalid uploadBlob input: ${typeof input}`) 29}