Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

korefile

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

korefile - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

18

lib/fsAdaptor.js

@@ -96,2 +96,20 @@ "use strict";

},
writeFiles: function (files) {
return __awaiter(this, void 0, void 0, function () {
var promises;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
promises = files.map(function (file) {
return _this.writeFile(file.path, file.content);
});
return [4 /*yield*/, Promise.all(promises)];
case 1:
_a.sent();
return [2 /*return*/];
}
});
});
},
deleteFile: function (filePath) {

@@ -98,0 +116,0 @@ return unlinkFile(path.resolve(cwd, filePath));

@@ -238,2 +238,10 @@ "use strict";

},
writeFiles: function (files) {
var withFileOption = __assign(__assign({}, filledOptions), { files: files });
var commitMessage = "Update files";
return getReferenceCommit(octKit, filledOptions)
.then(function (data) { return createTree(octKit, withFileOption, data); })
.then(function (data) { return createCommit(octKit, __assign(__assign({}, filledOptions), { commitMessage: commitMessage }), data); })
.then(function (data) { return updateReference(octKit, withFileOption, data); });
},
deleteFile: function (filePath) {

@@ -240,0 +248,0 @@ var commitMessage = options.commitMessage && typeof options.commitMessage.delete === "function"

6

lib/korefile.d.ts
import { KoreFileAdaptor } from "./KoreFileAdaptor";
export interface KoreFile {
readFile(filePath: string): Promise<string>;
writeFile(filePath: string, content: string): Promise<void>;
writeFile(filePath: string, content: string | ArrayBuffer): Promise<void>;
writeFiles(files: {
path: string;
content: string | ArrayBuffer;
}[]): Promise<void>;
deleteFile(filePath: string): Promise<void>;

@@ -6,0 +10,0 @@ }

@@ -15,2 +15,5 @@ "use strict";

return adaptor.writeFile(filePath, content);
},
writeFiles: function (files) {
return adaptor.writeFiles(files);
}

@@ -17,0 +20,0 @@ };

export interface KoreFileAdaptor {
readFile(filePath: string): Promise<string>;
writeFile(filePath: string, content: string | ArrayBuffer): Promise<void>;
writeFiles(files: {
path: string;
content: string | ArrayBuffer;
}[]): Promise<void>;
deleteFile(filePath: string): Promise<void>;
}

2

package.json
{
"name": "korefile",
"version": "2.0.0",
"version": "2.1.0",
"description": "File System API for Local/GitHub.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -32,2 +32,8 @@ import { KoreFileAdaptor } from "./KoreFileAdaptor";

},
async writeFiles(files: { path: string; content: string | ArrayBuffer }[]): Promise<void> {
const promises = files.map(file => {
return this.writeFile(file.path, file.content);
});
await Promise.all(promises);
},
deleteFile(filePath: string): Promise<void> {

@@ -34,0 +40,0 @@ return unlinkFile(path.resolve(cwd, filePath));

@@ -236,2 +236,16 @@ import { Octokit } from "@octokit/rest";

},
writeFiles(files: { path: string; content: string | ArrayBuffer }[]): Promise<void> {
const withFileOption = {
...filledOptions,
files: files
};
const commitMessage = `Update files`;
return getReferenceCommit(octKit, filledOptions)
.then(data => createTree(octKit, withFileOption, data))
.then(data => createCommit(octKit, {
...filledOptions,
commitMessage
}, data))
.then(data => updateReference(octKit, withFileOption, data));
},
deleteFile(filePath: string): Promise<void> {

@@ -238,0 +252,0 @@ const commitMessage = options.commitMessage && typeof options.commitMessage.delete === "function"

@@ -6,4 +6,6 @@ import { KoreFileAdaptor } from "./KoreFileAdaptor";

writeFile(filePath: string, content: string): Promise<void>;
writeFile(filePath: string, content: string | ArrayBuffer): Promise<void>;
writeFiles(files: { path: string; content: string | ArrayBuffer }[]): Promise<void>
deleteFile(filePath: string): Promise<void>;

@@ -22,4 +24,7 @@ }

return adaptor.writeFile(filePath, content);
},
writeFiles(files: { path: string; content: string | ArrayBuffer }[]): Promise<void> {
return adaptor.writeFiles(files);
}
};
};

@@ -6,3 +6,5 @@ export interface KoreFileAdaptor {

writeFiles(files: { path: string; content: string | ArrayBuffer }[]): Promise<void>;
deleteFile(filePath: string): Promise<void>;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc