ihub-cli 1.0.1 → 1.0.2
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/index.js +12 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -139,11 +139,18 @@ async function getFile(folder,cid,pinata) {
|
|
|
139
139
|
const arrayBuffer = await Data.arrayBuffer()
|
|
140
140
|
const buffer = Buffer.from(arrayBuffer);
|
|
141
141
|
console.log(buffer)
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
//tester
|
|
146
|
+
deleteFilesWithExtension(".history.bundle",".")
|
|
147
|
+
|
|
148
|
+
|
|
142
149
|
let dynamicstring=crypto.randomUUID()
|
|
143
150
|
let shortID = dynamicstring.substring(0, 5)
|
|
144
151
|
let bpath=`${shortID}.history.bundle`
|
|
145
152
|
|
|
146
|
-
|
|
153
|
+
fs.writeFileSync(`${bpath}`,buffer);
|
|
147
154
|
|
|
148
155
|
|
|
149
156
|
if (fs.existsSync(folder)){
|
|
@@ -178,7 +185,10 @@ async function getFileNew(folder,obj,pinata) {
|
|
|
178
185
|
|
|
179
186
|
function deleteFilesWithExtension(extension, folder) {
|
|
180
187
|
try {
|
|
181
|
-
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
const absolutePath = path.resolve(folder);
|
|
191
|
+
const files = fs.readdirSync(absolutePath);
|
|
182
192
|
|
|
183
193
|
for (const file of files) {
|
|
184
194
|
if (file.endsWith(extension)) {
|