mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
chore: remove form-data dependency (#6876)
chore: remove form-data dependency
This commit is contained in:
parent
79d3342c3d
commit
a4cfb51df5
4 changed files with 23 additions and 14 deletions
|
|
@ -1,8 +1,7 @@
|
|||
import axios, { AxiosRequestConfig, AxiosResponse } from 'axios';
|
||||
import byteSize from 'byte-size';
|
||||
import cliProgress from 'cli-progress';
|
||||
import FormData from 'form-data';
|
||||
import fs, { ReadStream, createReadStream } from 'node:fs';
|
||||
import fs, { createReadStream } from 'node:fs';
|
||||
import { CrawlService } from '../services/crawl.service';
|
||||
import { BaseCommand } from './base-command';
|
||||
import { basename } from 'node:path';
|
||||
|
|
@ -47,14 +46,14 @@ class Asset {
|
|||
|
||||
// TODO: doesn't xmp replace the file extension? Will need investigation
|
||||
const sideCarPath = `${this.path}.xmp`;
|
||||
let sidecarData: ReadStream | undefined = undefined;
|
||||
let sidecarData: Blob | undefined = undefined;
|
||||
try {
|
||||
await access(sideCarPath, constants.R_OK);
|
||||
sidecarData = createReadStream(sideCarPath);
|
||||
sidecarData = new File([await fs.openAsBlob(sideCarPath)], basename(sideCarPath));
|
||||
} catch {}
|
||||
|
||||
const data: any = {
|
||||
assetData: createReadStream(this.path),
|
||||
assetData: new File([await fs.openAsBlob(this.path)], basename(this.path)),
|
||||
deviceAssetId: this.deviceAssetId,
|
||||
deviceId: 'CLI',
|
||||
fileCreatedAt: this.fileCreatedAt,
|
||||
|
|
@ -269,7 +268,6 @@ export class UploadCommand extends BaseCommand {
|
|||
url,
|
||||
headers: {
|
||||
'x-api-key': this.immichApi.apiKey,
|
||||
...data.getHeaders(),
|
||||
},
|
||||
maxContentLength: Number.POSITIVE_INFINITY,
|
||||
maxBodyLength: Number.POSITIVE_INFINITY,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue