{"size": 1921, "ext": "js", "max_stars_repo_path": "test/collateral/extensions/oni-proxy-filesystem/extension.js", "max_stars_repo_name": "sijad/oni2", "max_stars_repo_stars_event_min_datetime": "2019-01-02T17:17:27.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T16:23:04.000Z", "max_issues_repo_path": "test/collateral/extensions/oni-proxy-filesystem/extension.js", "max_issues_repo_name": "sijad/oni2", "max_issues_repo_issues_event_min_datetime": "2019-01-03T20:15:11.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-27T03:07:37.000Z", "max_forks_repo_path": "test/collateral/extensions/oni-proxy-filesystem/extension.js", "max_forks_repo_name": "sijad/oni2", "max_forks_repo_forks_event_min_datetime": "2019-01-03T04:19:40.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-16T17:42:29.000Z"}
{"max_stars_count": 7524, "max_issues_count": 2218, "max_forks_count": 368, "avg_line_length": 26.3150684932, "max_line_length": 121, "alphanum_fraction": 0.683498178}
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
const vscode = require('vscode');

// this method is called when your extension is activated
// your extension is activated the very first time the command is executed

/**
 * @param {vscode.ExtensionContext} context
 */
function activate(context) {

	const showData = (val) => {
		vscode.window.showInformationMessage(JSON.stringify(val));
	};
	
	const disposable0 = vscode.commands.registerCommand("fs.stat", (args) => {
		showData("Command executed: " + JSON.stringify(args));


		//vscode.workspace.fs.writeFile(vscode.Uri.file("write.test"), new Uint8Array(1234), { create: true, overwrite: true});

		vscode.workspace.fs.stat(vscode.Uri.file("test.txt"))
		.then((statResult) => {
			showData({
				result: "success",
				payload: statResult,
			})
		}, (err) => {
			showData({
				result: "error",
				error: err,
			})
		});
	});

	const disposable1 = vscode.commands.registerCommand("fs.write", (args) => {
		showData("Command executed: " + JSON.stringify(args));


		const uint8Array = new Uint8Array(1234);
		vscode.workspace.fs.writeFile(vscode.Uri.file("write.test"), uint8Array, { create: true, overwrite: true});
	});

	const disposable2 = vscode.commands.registerCommand("fs.read", (args) => {
		showData("Command executed: " + JSON.stringify(args));

		vscode.workspace.fs.readFile(vscode.Uri.file("read.test"))
		.then((readResult) => {
			showData({
				result: "success",
				payload: readResult.toString(),
			})
		}, (err) => {
			showData({
				result: "error",
				payload: err,
			})
		});
	});
	context.subscriptions.push(disposable0);
	context.subscriptions.push(disposable1);
	context.subscriptions.push(disposable2);
}

// this method is called when your extension is deactivated
function deactivate() {}

module.exports = {
	activate,
	deactivate
}
