Skip to content

Commit

Permalink
Merge pull request #44 from qlambert-pro/createDirectory
Browse files Browse the repository at this point in the history
Create directory.
  • Loading branch information
terryzfeng authored Aug 30, 2024
2 parents cbad8ac + 11e970e commit a1ed23e
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dist/Chuck.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ export default class Chuck extends window.AudioWorkletNode {
* @param data Data to write to the file
*/
createFile(directory: string, filename: string, data: string | ArrayBuffer): void;
/**
* Create a virtual directory in ChucK's filesystem.
* @param parent Virtual directory to create the new directory in
* @param name Name of directory to create
*/
createDirectory(parent: string, name: string): void;
/**
* Automatically fetch and load in a file from a URL to ChucK's virtual filesystem
* @example
Expand Down
11 changes: 11 additions & 0 deletions dist/Chuck.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,17 @@ export default class Chuck extends window.AudioWorkletNode {
data,
});
}
/**
* Create a virtual directory in ChucK's filesystem.
* @param parent Virtual directory to create the new directory in
* @param name Name of directory to create
*/
createDirectory(parent, name) {
this.sendMessage(OutMessage.CREATE_DIRECTORY, {
parent,
name,
});
}
/**
* Automatically fetch and load in a file from a URL to ChucK's virtual filesystem
* @example
Expand Down
1 change: 1 addition & 0 deletions dist/enums.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export declare enum OutMessage {
CREATE_FILE = "createFile",
CREATE_DIRECTORY = "createDirectory",
RUN_CODE = "runChuckCode",
RUN_CODE_WITH_REPLACEMENT_DAC = "runChuckCodeWithReplacementDac",
REPLACE_CODE = "replaceChuckCode",
Expand Down
1 change: 1 addition & 0 deletions dist/enums.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export var OutMessage;
(function (OutMessage) {
OutMessage["CREATE_FILE"] = "createFile";
OutMessage["CREATE_DIRECTORY"] = "createDirectory";
// Run/Replace Code
OutMessage["RUN_CODE"] = "runChuckCode";
OutMessage["RUN_CODE_WITH_REPLACEMENT_DAC"] = "runChuckCodeWithReplacementDac";
Expand Down
11 changes: 11 additions & 0 deletions src/Chuck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,17 @@ export default class Chuck extends window.AudioWorkletNode {
data,
});
}
/**
* Create a virtual directory in ChucK's filesystem.
* @param parent Virtual directory to create the new directory in
* @param name Name of directory to create
*/
public createDirectory(parent: string, name: string) {
this.sendMessage(OutMessage.CREATE_DIRECTORY, {
parent,
name,
});
}
/**
* Automatically fetch and load in a file from a URL to ChucK's virtual filesystem
* @example
Expand Down
1 change: 1 addition & 0 deletions src/enums.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export enum OutMessage {
CREATE_FILE = "createFile",
CREATE_DIRECTORY = "createDirectory",

// Run/Replace Code
RUN_CODE = "runChuckCode",
Expand Down
12 changes: 12 additions & 0 deletions src/wc-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const defer = () => new DeferredPromise();
var OutMessage;
(function (OutMessage) {
OutMessage["CREATE_FILE"] = "createFile";
OutMessage["CREATE_DIRECTORY"] = "createDirectory";
// Run/Replace Code
OutMessage["RUN_CODE"] = "runChuckCode";
OutMessage["RUN_CODE_WITH_REPLACEMENT_DAC"] = "runChuckCodeWithReplacementDac";
Expand Down Expand Up @@ -300,6 +301,17 @@ class Chuck extends window.AudioWorkletNode {
data,
});
}
/**
* Create a virtual directory in ChucK's filesystem.
* @param parent Virtual directory to create the new directory in
* @param name Name of directory to create
*/
createDirectory(parent, name) {
this.sendMessage(OutMessage.CREATE_DIRECTORY, {
parent,
name,
});
}
/**
* Automatically fetch and load in a file from a URL to ChucK's virtual filesystem
* @example
Expand Down

0 comments on commit a1ed23e

Please sign in to comment.