catto.js 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GitHub.js +3 -2
- package/package.json +1 -1
package/GitHub.js
CHANGED
|
@@ -56,13 +56,14 @@ class GitHub {
|
|
|
56
56
|
*
|
|
57
57
|
* @param {string} file - Path to the file to be written.
|
|
58
58
|
* @param {(string|object)} value - The data to be written to the file. If it is an object, it will be stringified as a JSON file.
|
|
59
|
+
* @param {boolean} [b64mode=false] - Whetever is data to be written is encoded in base64 or not.
|
|
59
60
|
*
|
|
60
61
|
* @returns {boolean} - Returns true if the write was successful.
|
|
61
62
|
*
|
|
62
63
|
* @async
|
|
63
64
|
* @throws {Error} If there is a problem with the API request.
|
|
64
65
|
*/
|
|
65
|
-
async write(file, value) {
|
|
66
|
+
async write(file, value, b64mode) {
|
|
66
67
|
if (typeof value === "object") {
|
|
67
68
|
value = JSON.stringify(value);
|
|
68
69
|
}
|
|
@@ -74,7 +75,7 @@ class GitHub {
|
|
|
74
75
|
"Content-Type": "application/json"
|
|
75
76
|
},
|
|
76
77
|
"body": JSON.stringify({
|
|
77
|
-
"content": Base64.encode(value),
|
|
78
|
+
"content": (b64mode ? value : Base64.encode(value)),
|
|
78
79
|
"message": this.options.message,
|
|
79
80
|
"sha": this.shas[file]
|
|
80
81
|
})
|