Scroll to navigation

JS-BEAUTIFY(1) User Commands JS-BEAUTIFY(1)

NAME

js-beautify - beautify, unpack or deobfuscate JavaScript

SYNOPSIS

jsbeautifier.py [options] <infile>

DESCRIPTION

jsbeautifier.py@1.15.1

Javascript beautifier (https://beautifier.io/)

<infile> can be "-", which means stdin.

Input options:

Read input from stdin

Output options:

Indentation size. (default 4).
Character to indent with. (default space).
Character(s) to use as line terminators. (default first newline in file, otherwise "\n")
Indent with tabs, overrides -s and -c
Do not preserve existing line breaks.
Add padding spaces within paren, ie. f( a, b )
Add a single space inside empty paren, ie. f( )
More jslint-compatible output
Add a space before an anonymous function's parens, ie. function ()
Add a space before a named function's parens, i.e. function example ()
Brace style (collapse, expand, end-expand, none)(,preserve-inline)
Keep array indentation.
Suppress info about a file if nothing was changed.
Write output in-place, replacing input
Specify a file to output to (default stdout)
Do not re-indent function bodies defined in var lines.
Decode printable chars encoded in \xNN notation.
Pass E4X xml literals through untouched
Put commas at the beginning of new line instead of end.

-m,

Number of line-breaks to be preserved in one chunk (default 10)
Set operator position (before-newline, after-newline, preserve-newline)
Attempt to wrap line when it exceeds this length. NOTE: Line continues until next wrap point is found.
End output with newline
Keep indentation on empty lines
List of templating languages (auto,none,django,erb,handlebars,php,smarty,angular) ["auto"] auto = none in JavaScript, all in html
Enable setting configuration from EditorConfig

Rarely needed options:

evaluate code if a JS interpreter is installed. May be useful with some obfuscated script but poses a potential security issue.
Initial indentation level. (default 0).
Prints this help statement.
Show the version
March 2024 js-beautify 1.15.1