Check out this post on using JSBeautify with Textmate. It has some good instructions on how to install it on your system. On Mac OS X, I used:

cd /tmp
git clone https://github.com/einars/js-beautify.git
cd js-beautify/python
python setup.py install

Then you can simply use js-beautify /path/to/filename.js to have it run.

Answer from cwd on Stack Overflow
🌐
PyPI
pypi.org › project › jsbeautifier
jsbeautifier · PyPI
Download URL: jsbeautifier-1.15.4-py3-none-any.whl · Upload date: Feb 27, 2025 · Size: 94.7 kB · Tags: Python 3 · Uploaded using Trusted Publishing? No · Uploaded via: twine/6.1.0 CPython/3.11.11 · See more details on using hashes here. Supported by ·
      » pip install jsbeautifier
    
Published   Feb 27, 2025
Version   1.15.4
🌐
GitHub
github.com › beautifier › js-beautify
GitHub - beautifier/js-beautify: Beautifier for javascript · GitHub
After installing, to beautify using Python: $ js-beautify file.js · Beautified output goes to stdout by default. To use jsbeautifier as a library is simple: import jsbeautifier res = jsbeautifier.beautify('your JavaScript string') res = jsbeautifier.beautify_file('some_file.js') ...or, to specify some options: opts = jsbeautifier.default_options() opts.indent_size = 2 opts.space_in_empty_paren = True res = jsbeautifier.beautify('some JavaScript', opts) The configuration option names are the same as the CLI names but with underscores instead of dashes.
Author   beautifier
🌐
Arch Linux
archlinux.org › packages › extra › any › python-jsbeautifier
Arch Linux - python-jsbeautifier 1.15.4-2 (any)
View the file list for python-jsbeautifier · View the soname list for python-jsbeautifier · Copyright © 2002-2026 Judd Vinet, Aaron Griffin and Levente Polyák. The Arch Linux name and logo are recognized trademarks. Some rights reserved.
🌐
Snyk
snyk.io › advisor › jsbeautifier › jsbeautifier code examples
Top 5 jsbeautifier Code Examples | Snyk
def __init__(self, input_string, opts): BaseTokenizer.__init__(self, input_string, opts) # This is not pretty, but given how we did the version import # it is the only way to do this without having setup.py fail on a missing # six dependency. self._six = __import__("six") import jsbeautifier.javascript.acorn as acorn self.acorn = acorn self.in_html_comment = False self.has_char_escapes = False # comment ends just before nearest linefeed or end of file # IMPORTANT: This string must be run through six to handle \u chars self._whitespace_pattern = re.compile( self._six.u(r'[\n\r\u2028\u2029\t\u00
🌐
GitHub
github.com › beautifier › js-beautify › blob › main › python › jsbeautifier › __init__.py
js-beautify/python/jsbeautifier/__init__.py at main · beautifier/js-beautify
# Python is not my native language, feel free to push things around. # # Use either from command line (script displays its usage when run · # without any parameters), # # # or, alternatively, use it as a module: # # import jsbeautifier ·
Author   beautifier
🌐
ProgramCreek
programcreek.com › python › example › 108358 › jsbeautifier.beautify
Python Examples of jsbeautifier.beautify
def add_answer_to_ccr_swag(ccr_path, dataset_path, output_path): with open(ccr_path, "r", encoding="utf8") as f: ccr = json.load(f) with open(dataset_path, "r", encoding="utf8") as csvfile: reader = csv.reader(csvfile) next(reader) # Skip first line (header). for i, row in tqdm(enumerate(reader)): stem = row[4] + " " + row[5] answers = row[7:11] for j, ans in enumerate(answers): ccr[i * 4 + j]["stem"] = stem.lower() ccr[i * 4 + j]["answer"] = ans.lower() with open(output_path, "w", encoding="utf8") as f: import jsbeautifier opts = jsbeautifier.default_options() opts.indent_size = 2 f.write(jsbeautifier.beautify(json.dumps(ccr), opts)) #json.dump(ccr, f) # python add_answer_to_ccr.py --mode csqa --ccr_path csqa_new/train_rand_split.jsonl.statements.ccr --dataset_path csqa_new/train_rand_split.jsonl.statements --output_path csqa_new/train_rand_split.jsonl.statements.ccr.a
🌐
Beautifier
beautifier.io
Online JavaScript beautifier
All of the source code is completely free and open, available on GitHub under MIT licence, and we have a command-line version, python library and a node package as well.
🌐
piwheels
piwheels.org › project › jsbeautifier
piwheels - jsbeautifier
pip3 install jsbeautifier · six · editorconfig · PyPI page · pypi.org/ project/ jsbeautifier · Project JSON · piwheels.org/ project/ jsbeautifier/ json · Versions · 113 · Files · 109 · Downloads · (all time) loading... Downloads · (last 30 days) loading...
Find elsewhere
🌐
UNPKG
unpkg.com › browse › js-beautify@0.4.2 › README.md
UNPKG
### Python `./js-beautify file.js` beautifies a file, output goes to `stdout`. To use `jsbeautifier` as a library is simple: ``` python import jsbeautifier res = jsbeautifier.beautify('your javascript string') res = jsbeautifier.beautify_file('some_file.js') ``` ...or, to specify some options: ``` python opts = jsbeautifier.default_options() opts.indent_size = 2 res = jsbeautifier.beautify('some javascript', opts) ``` ### JavaScript As an alternative to the Python script, you may install the NPM package `js-beautify`. When installed globally, it provides an executable `js-beautify` script.
🌐
Snyk
snyk.io › advisor › jsbeautifier › functions › jsbeautifier.default_options
How to use the jsbeautifier.default_options function in jsbeautifier | Snyk
#!/usr/bin/env python # -*- coding: utf-8 -*- import io import os import copy import jsbeautifier options = jsbeautifier.default_options() options.wrap_line_length = 80 data = '' data_min = '' def beautifier_test_underscore(): jsbeautifier.beautify(data, options) def beautifier_test_underscore_min(): jsbeautifier.beautify(data_min, options) def beautifier_test_github_min(): jsbeautifier.beautify(github_min, options)
🌐
Snyk
snyk.io › advisor › jsbeautifier › functions › jsbeautifier.beautify_file
How to use the jsbeautifier.beautify_file function in jsbeautifier | Snyk
import jsbeautifier import sys import os import random filename = sys.argv[2]+"-"+str(os.times()[4])+"-"+str(random.randint(1,99999))+".txt" os.system("copy NUL db/"+filename) parser = open(sys.argv[1],"r") body = parser.read().split('\r\n\r\n') with open("db/"+filename,'w') as f: f.write(body[1]) parser.close() res = jsbeautifier.beautify_file("db/"+filename) with open("db/"+filename,'w') as f: f.write(res) print filename ·
🌐
Kali Linux Tools
en.kali.tools
JS Beautifier - Penetration Testing Tools
sudo pacman -R python-jsbeautifier sudo pacman -S npm sudo npm -g install js-beautify js-beautify -h
🌐
Ubuntu
launchpad.net › ubuntu › +source › python-jsbeautifier
python-jsbeautifier package : Ubuntu
jsbeautifier: JavaScript unobfuscator and beautifier python3- jsbeautifier: JavaScript unobfuscator and beautifier (python3) This package has 2 new bugs and 0 open questions. Maintainer: Håvard F. Aasen · Urgency:* Medium Urgency · Architectures:* all · Latest upload: 1.15.3-1 ·
🌐
Kali Linux Tools
en.kali.tools › all
python-jsbeautifier
Home / Tools / python-jsbeautifier · List of all available tools for penetration testing. Description: JavaScript unobfuscator and beautifier · Category: reversing webapp · Version: 1.15.1 · WebSite: https://github.com/beautify-web/js-beautify · Last Updated: 2024-02-21 ·
🌐
Arch Linux ARM
archlinuxarm.org › packages › aarch64 › python-jsbeautifier
python-jsbeautifier (aarch64) | Packages | Arch Linux ARM
Copyright ©2009-2026 Arch Linux ARM The registered trademark Linux® is used pursuant to a sublicense from LMI, the exclusive licensee of Linus Torvalds, owner of the mark on a world-wide basis. The Arch Linux™ name and logo are used under permission of the Arch Linux Project Lead
🌐
GitHub
gist.github.com › m4ll0k › 033c81a36e1e3cf06e8eb9d42e881a1e
Javascript Beautifier with Python · GitHub
Javascript Beautifier with Python . GitHub Gist: instantly share code, notes, and snippets.
🌐
Snyk
snyk.io › advisor › jsbeautifier › functions › jsbeautifier.jsbeautifier.javascript.beautifier.mode
How to use the jsbeautifier.jsbeautifier.javascript.beautifier.MODE function in jsbeautifier | Snyk
To help you get started, we've selected a few jsbeautifier.jsbeautifier.javascript.beautifier.MODE examples, based on popular ways it is used in public projects.