Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix probable sources of memory leaks #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class S3Storage implements StorageEngine {
}

public _handleFile(req: Request, file: EFile, cb: (error?: any, info?: Info) => void) {
const { opts, sharpOpts } = this
const { opts } = this
const { mimetype, stream } = file
const params = {
Bucket: opts.Bucket,
Expand Down Expand Up @@ -161,7 +161,7 @@ export class S3Storage implements StorageEngine {
const upload$ = from(
upload.promise().then((result) => {
// tslint:disable-next-line
const { Body, ...rest } = size
const { ...rest } = size
return {
...result,
...rest,
Expand All @@ -177,8 +177,8 @@ export class S3Storage implements StorageEngine {
const mapArrayToObject: { [k: string]: any } = res.reduce(
(acc, curr) => {
// tslint:disable-next-line
const { suffix, ContentType, size, format, channels, options, currentSize, ...rest } = curr
acc[curr.suffix] = {
const { suffix, ContentType, currentSize, ...rest } = curr
acc[suffix] = {
ACL,
ContentDisposition,
StorageClass,
Expand Down Expand Up @@ -228,7 +228,7 @@ export class S3Storage implements StorageEngine {
)
.subscribe((result) => {
// tslint:disable-next-line
const { size, format, channels, ...rest } = result
const { size, format, ...rest } = result
const endRes = {
ACL,
ContentDisposition,
Expand All @@ -238,7 +238,7 @@ export class S3Storage implements StorageEngine {
...rest,
size: currentSize || size,
ContentType: opts.ContentType || format,
mimetype: lookup(result.format) || `image/${result.format}`
mimetype: lookup(format) || `image/${format}`
}
cb(null, JSON.parse(JSON.stringify(endRes)))
}, cb)
Expand Down