8000 Restored the text-based fs_cat method and implemented fs_cat_binary. · arduino/micropython.js@ab3070f · GitHub
[go: up one dir, main page]

Skip to content

Commit ab3070f

Browse files
committed
Restored the text-based fs_cat method and implemented fs_cat_binary.
Signed-off-by: ubi de feo <me@ubidefeo.com>
1 parent f3e2c58 commit ab3070f

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

micropython.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ class MicroPythonBoard {
256256
return Promise.resolve(files)
257257
}
258258

259-
async fs_cat(filePath) {
259+
async fs_cat_binary(filePath) {
260260
if (filePath) {
261261
await this.enter_raw_repl()
262262
let output = await this.exec_raw(
@@ -269,18 +269,18 @@ class MicroPythonBoard {
269269
return Promise.reject(new Error(`Path to file was not specified`))
270270
}
271271

272-
// async fs_cat(filePath) {
273-
// if (filePath) {
274-
// await this.enter_raw_repl()
275-
// let output = await this.exec_raw(
276-
// `with open('${filePath}','r') as f:\n while 1:\n b=f.read(256)\n if not b:break\n print(b,end='')`
277-
// )
278-
// await this.exit_raw_repl()
279-
// output = extract(output)
280-
// return Promise.resolve(fixLineBreak(output))
281-
// }
282-
// return Promise.reject(new Error(`Path to file was not specified`))
283-
// }
272+
async fs_cat(filePath) {
273+
if (filePath) {
274+
await this.enter_raw_repl()
275+
let output = await this.exec_raw(
276+
`with open('${filePath}','r') as f:\n while 1:\n b=f.read(256)\n if not b:break\n print(b,end='')`
277+
)
278+
await this.exit_raw_repl()
279+
output = extract(output)
280+
return Promise.resolve(fixLineBreak(output))
281+
}
282+
return Promise.reject(new Error(`Path to file was not specified`))
283+
}
284284

285285
async fs_put(src, dest, data_consumer) {
286286
data_consumer = data_consumer || function() {}

0 commit comments

Comments
 (0)
0