|
|
|
|
@ -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,
|
|
|
|
|
|