Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-date-suffix

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-date-suffix

Grunt plugin for renaming a file with date suffix.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

NPM Version NPM Downloads Build Status Dependency Status ![Gitter](https://badges.gitter.im/Join Chat.svg)

grunt-date-suffix

Grunt plugin for renaming a file with a date suffix.

Install

npm install grunt-date-suffix --save-dev

Grunt configuration

datesuffix: {
  rename1: {
    
    /**
     * Original filename (with path if not in current directory)
     * @required
     */
    file: "test.txt",
    
    /**
     * If move file to other directory, define here.
     * @optional
     */
    dest: "outputDir"
    
    /**
     * Divider between filename and date.
     * @optional
     * @default "."
     */
    divider: "-"
    
    /**
     * Switch behavior from "rename/move" to "copy".
     * @optional
     * @default false
     */
    copy: true,
    
    /**
     * Datetime format. Used node library `date-format`.
     * @optional
     * @default "yyyyMMddhhmmssSSS"
     */     
    date_format: "yyyyMMdd"
  },
}

Configuration example

//Gruntfile.js
  grunt.initConfig({
    datesuffix: {
      test1: {
        file: "test.txt",               //required
      },
      test2: {
        file: "test.txt",               //required
        dest: "outputDir",              //default: undefined
      },
      test3: {
        file: "test.txt",               //required
        dest: "output",                 //default: undefined
        copy: true,                     //default: false
        date_format: "yyyyMMdd"         //default: "yyyyMMddhhmmssSSS"
      },
      test4: {
        files: "filedoesnotexist.txt",  //required
        ignore_nonexistent: true        //default: false
      },
      test5: {
        files: "filedoesnotexist.txt",  //required
        divider: "-"                    //default: "."
      }
    }
  });

  grunt.loadNpmTasks("grunt-date-suffix");

Use

grunt datesuffix:test1
grunt datesuffix:test2
grunt datesuffix:test3
grunt datesuffix:test4
grunt datesuffix:test5

####Result

# test1
  test.20150116201020123.txt
  
# test2
  output/test.20150116201020123.txt
  
# test3
  test.txt
  output/test.20150116.txt
  
# test4
# no error is thrown even if the file does not exist

# test5
  test-20150116201020123.txt

Keywords

FAQs

Package last updated on 03 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc