-
Notifications
You must be signed in to change notification settings - Fork 243
Open
Labels
help wantedIssues identified as good community contribution opportunitiesIssues identified as good community contribution opportunities
Description
Use native built in FormData instead of using any other dependency and use built in fetch to send it instead.
Line 13 in 2aeafb2
| import FormData from 'form-data'; |
Lines 280 to 297 in 2aeafb2
| const form = new FormData(); | |
| const lineBreak = '\r\n'; | |
| form.setBoundary('0f411892-ef48-488f-89d3-4f0546e84723'); | |
| form.append('vsix', packageStream, { | |
| header: `--${form.getBoundary()}${lineBreak}Content-Disposition: attachment; name=vsix; filename=\"${packageName}\"${lineBreak}Content-Type: application/octet-stream${lineBreak}${lineBreak}` | |
| }); | |
| form.append('sigzip', sigzipStream, { | |
| header: `--${form.getBoundary()}${lineBreak}Content-Disposition: attachment; name=sigzip; filename=\"${sigzipName}\"${lineBreak}Content-Type: application/octet-stream${lineBreak}${lineBreak}` | |
| }); | |
| const publishWithRetry = retry(handleWhen(err => err.message.includes('timeout')), { | |
| maxAttempts: 3, | |
| backoff: new IterableBackoff([5_000, 10_000, 20_000]) | |
| }); | |
| return await publishWithRetry.execute(async () => { | |
| return await api.publishExtensionWithPublisherSignature(undefined, form, manifest.publisher, manifest.name, extensionType); | |
| }); |
Line 53 in 2aeafb2
| "form-data": "^4.0.0", |
the only way to get a blob in nodejs and append it to a formdata is if you use fs.openAsBlob
import { openAsBlob } from 'node:fs';
const blob = await openAsBlob(path, { type: 'application/octet-stream' })
formData.append('vsix', blob, packageName)
fetch(...)ever since ljharb took over form-data pkg, it only got more sub dependencies and increased size
the other alternative is to construct a own Blob/File yourself
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
help wantedIssues identified as good community contribution opportunitiesIssues identified as good community contribution opportunities