Skip to content

[js] 第700天 下列哪个是Javascript做不到的 #3693

Open
@haizhilin2013

Description

@haizhilin2013
Collaborator

第700天 下列哪个是Javascript做不到的

作者:310342136

3+1官网

我也要出题

下列哪个是Javascript做不到的

a. 调整window大小

b. 改变地址状态栏

c. 重命名C盘的文件

d. 任意删除磁盘上的文件

Activity

Blackn-L

Blackn-L commented on Mar 17, 2021

@Blackn-L

D

githubzml

githubzml commented on Mar 19, 2021

@githubzml

D

删除文件

const fs = require('fs');
fs.unlinkSync(path)

删除文件夹

const fs = require('fs');

function deleteFolderRecursive(path) {
    var files = [];
    if (fs.existsSync(path)) {
        files = fs.readdirSync(path);
        files.forEach(function(file, index) {
            var curPath = path + "/" + file;
            if (fs.statSync(curPath).isDirectory()) { // recurse
                deleteFolderRecursive(curPath);
            } else { // delete file
                fs.unlinkSync(curPath);
            }
        });
        fs.rmdirSync(path);
    }
};
deleteFolderRecursive(path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    jsJavaScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @haizhilin2013@githubzml@Blackn-L

        Issue actions

          [js] 第700天 下列哪个是Javascript做不到的 · Issue #3693 · haizlin/fe-interview