Skip to content

Commit

Permalink
Finish clean up from last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
strazzere committed Sep 20, 2021
1 parent 5181ae0 commit 7740a80
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
9 changes: 2 additions & 7 deletions src/instance.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const NetworkMonitor = require("./netmon");
const { sleep } = require("./util/sleep");
const util = require("util");
const fs = require("fs");
const { isCompressed, compress, uploadFile } = require("./images");
const { compress, uploadFile } = require("./images");
const uuidv4 = require("uuid/v4");

/**
Expand Down Expand Up @@ -827,12 +827,7 @@ class Instance extends EventEmitter {

tmpfile = await compress(data, name);

let uploadedImage = await this.uploadImage(
"kernel",
tmpfile ? tmpfile : filePath,
name,
progress,
);
let uploadedImage = await this.uploadImage("kernel", tmpfile, name, progress);

if (tmpfile) {
fs.unlinkSync(tmpfile);
Expand Down
8 changes: 3 additions & 5 deletions src/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const InstanceUpdater = require("./instance-updater");
const uuidv4 = require("uuid/v4");
const util = require("util");
const fs = require("fs");
const { isCompressed, compress, uploadFile } = require("./images");
const { compress, uploadFile } = require("./images");

/**
* @typedef {object} ProjectKey
Expand Down Expand Up @@ -332,11 +332,9 @@ class Project {
let tmpfile = null;
const data = await util.promisify(fs.readFile)(filePath);

if (!isCompressed(data)) {
tmpfile = await compress(data, name);
}
tmpfile = await compress(data, name);

let image = await this.uploadImage("kernel", tmpfile ? tmpfile : filePath, name, progress);
let image = await this.uploadImage("kernel", tmpfile, name, progress);

if (tmpfile) {
fs.unlinkSync(tmpfile);
Expand Down

0 comments on commit 7740a80

Please sign in to comment.