Skip to content

Commit

Permalink
chore: formating
Browse files Browse the repository at this point in the history
  • Loading branch information
wkillerud committed Jul 30, 2024
1 parent 7d55c4d commit 65e8a8d
Show file tree
Hide file tree
Showing 3 changed files with 311 additions and 312 deletions.
50 changes: 25 additions & 25 deletions lib/entry.js
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
import crypto from 'node:crypto';
import crypto from "node:crypto";

export default class Entry {
constructor({ mimeType = 'application/octet-stream', payload = [] } = {}) {
this._mimeType = mimeType;
this._payload = payload;
this._hash = '';
constructor({ mimeType = "application/octet-stream", payload = [] } = {}) {
this._mimeType = mimeType;
this._payload = payload;
this._hash = "";

if (Array.isArray(payload)) {
const hash = crypto.createHash('sha512');
payload.forEach((buffer) => {
hash.update(buffer.toString());
});
this._hash = `sha512-${hash.digest('base64')}`;
}
}
if (Array.isArray(payload)) {
const hash = crypto.createHash("sha512");
payload.forEach((buffer) => {
hash.update(buffer.toString());
});
this._hash = `sha512-${hash.digest("base64")}`;
}
}

get mimeType() {
return this._mimeType;
}
get mimeType() {
return this._mimeType;
}

get payload() {
return this._payload;
}
get payload() {
return this._payload;
}

get hash() {
return this._hash;
}
get hash() {
return this._hash;
}

get [Symbol.toStringTag]() {
return 'Entry';
}
get [Symbol.toStringTag]() {
return "Entry";
}
}
Loading

0 comments on commit 65e8a8d

Please sign in to comment.