fix(core): 修复在线版ampy写文件异常
This commit is contained in:
@@ -237,8 +237,10 @@ class AmpyExt extends Ampy {
|
|||||||
}
|
}
|
||||||
await this.exec(`file = open('${filename}', 'wb')`, timeout);
|
await this.exec(`file = open('${filename}', 'wb')`, timeout);
|
||||||
let buffer = null;
|
let buffer = null;
|
||||||
if (typeof data === 'string') {
|
if (data.constructor === String) {
|
||||||
buffer = this.#device_.encode(data);
|
buffer = this.#device_.encode(data);
|
||||||
|
} else if (data.constructor === ArrayBuffer) {
|
||||||
|
buffer = new Uint8Array(data);
|
||||||
} else {
|
} else {
|
||||||
buffer = data;
|
buffer = data;
|
||||||
}
|
}
|
||||||
@@ -255,7 +257,7 @@ class AmpyExt extends Ampy {
|
|||||||
}
|
}
|
||||||
await this.exec(`file.write(b'${writeStr}')`, timeout);
|
await this.exec(`file.write(b'${writeStr}')`, timeout);
|
||||||
}
|
}
|
||||||
await this.exec(`file.close()`, timeout);
|
await this.exec('file.close()', timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
async ls(directory = '/', longFormat = true, recursive = false, timeout = 5000) {
|
async ls(directory = '/', longFormat = true, recursive = false, timeout = 5000) {
|
||||||
|
|||||||
Reference in New Issue
Block a user