icebox/dist/monitor/index.js

33 lines
1.2 KiB
JavaScript

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const upload_1 = require("../upload");
const log_1 = require("../log");
const chokidar_1 = __importDefault(require("chokidar"));
const EXPIRATION = 3600; //1 hour
const log = (0, log_1.createLog)('files');
async function processUpload(filePath) {
const config = {
region: 'us-east-1',
bucketName: 'your-bucket-name',
expirationSeconds: EXPIRATION
};
log.info(`Started upload: ${filePath}`);
const result = await (0, upload_1.upload)('test', filePath, config);
if (result.success) {
log.info('File ${filePath} uploaded successfully!');
log.info('Private URL:', result.url);
}
else {
log.error('Upload failed:', result.error);
}
}
async function main() {
chokidar_1.default.watch('./watch', { ignored: /(^|[/\\])\../ }).on('all', (event, path) => {
log.info(`File ${path} changed with event type ${event}`);
});
}
main().catch(log.error);
//# sourceMappingURL=index.js.map