converter-toless-plugin
Advanced tools
Comparing version 0.1.245 to 0.1.246
@@ -16,3 +16,3 @@ "use strict"; | ||
function deleteFile(filePath) { | ||
fs_1.default.unlink(filePath, (err) => { | ||
fs_1.unlink(filePath, (err) => { | ||
if (err) { | ||
@@ -26,3 +26,3 @@ console.log(err); | ||
return new Promise((solve) => { | ||
fs_1.default.rmdir(dirPath, { recursive: true }, solve); | ||
fs_1.rmdir(dirPath, { recursive: true }, solve); | ||
}); | ||
@@ -32,3 +32,3 @@ } | ||
function deleteAllFilesInDirectory(dir) { | ||
fs_1.default.readdir(dir, (err, files) => { | ||
fs_1.readdir(dir, (err, files) => { | ||
if (err) | ||
@@ -38,3 +38,3 @@ throw err; | ||
try { | ||
fs_1.default.unlink(path_1.join(dir, file), err => { | ||
fs_1.unlink(path_1.join(dir, file), err => { | ||
if (err) | ||
@@ -41,0 +41,0 @@ throw err; |
@@ -10,3 +10,3 @@ "use strict"; | ||
function upload_file(props) { | ||
var storage = multer_1.default.diskStorage({ | ||
var storage = multer_1.diskStorage({ | ||
destination: (req, file, cb) => { | ||
@@ -17,3 +17,3 @@ cb(null, props.dest); | ||
const fileprops = utils_1.getProps(file.originalname); | ||
cb(null, `${fileprops.name}_F_${randomstring_1.generate(props.randomStringSize)}.${mime_types_1.default.extension(file.mimetype)}`); | ||
cb(null, `${fileprops.name}_F_${randomstring_1.generate(props.randomStringSize)}.${mime_types_1.extension(file.mimetype)}`); | ||
} | ||
@@ -20,0 +20,0 @@ }); |
{ | ||
"name": "converter-toless-plugin", | ||
"version": "0.1.245", | ||
"version": "0.1.246", | ||
"description": "this is a plugin", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
import { join } from "path" | ||
import fs from "fs" | ||
import { unlink, rmdir, readdir } from "fs" | ||
@@ -21,3 +21,3 @@ import type { Compiler } from "../../d/types" | ||
export function deleteFile(filePath: string) { | ||
fs.unlink(filePath, (err) => { | ||
unlink(filePath, (err) => { | ||
if (err) { | ||
@@ -32,3 +32,3 @@ console.log(err) | ||
return new Promise((solve) => { | ||
fs.rmdir(dirPath, { recursive: true }, solve) | ||
rmdir(dirPath, { recursive: true }, solve) | ||
}) | ||
@@ -39,3 +39,3 @@ | ||
export function deleteAllFilesInDirectory(dir: string) { | ||
fs.readdir(dir, (err, files) => { | ||
readdir(dir, (err, files) => { | ||
if (err) throw err; | ||
@@ -45,3 +45,3 @@ | ||
try { | ||
fs.unlink(join(dir, file), err => { | ||
unlink(join(dir, file), err => { | ||
if (err) throw err; | ||
@@ -48,0 +48,0 @@ }); |
@@ -1,5 +0,5 @@ | ||
import multer from "multer" | ||
import multer, { diskStorage } from "multer" | ||
import { getProps } from "../components/utils"; | ||
import mime from "mime-types" | ||
import { extension } from "mime-types" | ||
// for generating random strings | ||
@@ -19,3 +19,3 @@ import { generate as generateRandomString } from "randomstring"; | ||
export default function upload_file(props: upload_file_propies) { | ||
var storage = multer.diskStorage({ | ||
var storage = diskStorage({ | ||
destination: (req: Request<any, any, any, any, Record<string, any>>, file: any, cb: (error: Error | null, filename: string) => void) => { | ||
@@ -26,3 +26,3 @@ cb(null, props.dest) | ||
const fileprops = getProps(file.originalname) | ||
cb(null, `${fileprops.name}_F_${generateRandomString(props.randomStringSize)}.${mime.extension(file.mimetype)}`) | ||
cb(null, `${fileprops.name}_F_${generateRandomString(props.randomStringSize)}.${extension(file.mimetype)}`) | ||
} | ||
@@ -29,0 +29,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47070