write file in disk base on filesystem api of chrome
npm install disk-file-writer#
disk-file-writer
1. Create a local logging system
* write log into disk files
* set max size for each log file
* log rotate
* keep the log file in a safe disk place where only chrome can access, and provide ways to move it to real folder
2. Recording a web meeting locally
* write recorded stream into disk file
* add multiple audio stream, mix it and write to file
- install
``basj`
npm install disk-file-writer
- init
`js
import FileLogger from 'disk-file-writer';
FileLogger.createUI();
`
then we have the UI:
1. choose where to store files
!img
click the choose where to store file button will open the system folder, this is where you choose your root folder to store all the log files and video recording files.choose where to store file
2. local recoding
when you have choose the folder to store file, the button will be removed, then you can click the start recording button, thre browser will ask to select a window/screen/browser tab to record.zoomvideos
!img
the default sub-folder to store recording file is , so you can find the recording here:debugging
!img
3. debugging log
sometimes we want to open log file and see it updating in real time. we can doing it by simply click the button:real-time log.txt
!img
why don't we open the ? because the file is being open and close every 1s, so we can't see the updated the file content if we keep the file open.`
so we have to utilize some tools to see it:
1. in mac, we use
`
tail -F path_to_file
`
2. in windows, we use
``
Get-Content path_to_file -Wait -Tail 10
4. request permission
we store the root directory handle in indexedDB, so you don't have to re-select the directory handle after page refreshment
but that doesn't mean we can use the file handle from indexedDB directly, we need the browser to grant permission of read-write after page refreshment.
