How to use the hexo-fs.rename function in hexo-fs

To help you get started, we’ve selected a few hexo-fs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hexojs / hexo / test / scripts / box / box.js View on Github external
    ]).then(() => box.watch()).then(() => fs.rename(src, newSrc)).delay(500).then(() => {
      const lastTwoCalls = processor.args.slice(processor.args.length - 2, processor.args.length);
github hexojs / hexo / test / scripts / box / box.js View on Github external
    ]).then(() => box.watch()).then(() => fs.rename(pathFn.join(box.base, 'a'), pathFn.join(box.base, 'b'))).delay(500).then(() => {
      const lastTwoCalls = processor.args.slice(processor.args.length - 2, processor.args.length);
github tajpure / hexo-editor / models / file-manager.js View on Github external
moveToDraft(article, workspace) {
    const draft_dir = this.draft_dir;
    const filename = (article.filename ? article.filename : article.title) + suffix;
    const oldPath = this.getPathByWorkspace(workspace) + filename;
    const newPath = draft_dir + filename;
    fs.rename(oldPath, newPath)
      .then((err) => {
        if (err) {
          console.err(err);
        }
      });
  }
github tajpure / hexo-editor / models / file-manager.js View on Github external
moveToTrash(article, workspace) {
    const trash_dir = this.trash_dir;
    const filename = article.filename + suffix;
    const oldPath = this.getPathByWorkspace(workspace) + filename;
    const newPath = trash_dir + filename;
    fs.rename(oldPath, newPath)
      .then((err) => {
        if (err) {
          console.err(err);
        }
      });
  }
github tajpure / hexo-editor / models / file-manager.js View on Github external
moveToPost(article, workspace) {
    const filename = article.filename + suffix;
    const oldPath = this.getPathByWorkspace(workspace) + filename;
    const newPath = this.post_dir + filename;
    fs.rename(oldPath, newPath)
      .then((err) => {
        if (err) {
          console.err(err);
        }
      });
  }
github thesadabc / hexo-myadmin / lib / service / post.js View on Github external
publish(id) {
        if (this.type === "Page") return;
        let post = this.detail(id);
        let postDir = path.join(this.hexo.source_dir, '_posts');
        let newFullSource = path.join(postDir, path.basename(post.full_source));

        return fs.rename(post.full_source, newFullSource).then(() => this.updateDB());
    }
github thesadabc / hexo-myadmin / lib / service / post.js View on Github external
            .then(() => fs.rename(post.full_source, newFullSource))
            .then(() => this.updateDB());