How to mimic php crypt() on NODE.JS

Please help with php -> javascript(node.js) conversion

$key = crypt($key, $salt);

I'm rewriting php script with node.js, and I got stuck with hash signature generation in php, which is made using crypt() function with salt matching "CRYPT_EXT_DES" pattern

CRYPT_EXT_DES - Extended DES-based hash. The "salt" is a 9-character string consisting of an underscore followed by 4 bytes of iteration count and 4 bytes of salt. These are encoded as printable characters, 6 bits per character, least significant character first. The values 0 to 63 are encoded as "./0-9A-Za-z". Using invalid characters in the salt will cause crypt() to fail.

I'm not really experienced with encryption, and studying node.js docs on crypto module didnt help. Please help how to implement this on node.js!

If you're looking for an exact implementation of PHP's crypt() in JavaScript, you may want to take a look at:

http://phpjs.org/functions/get_extension_funcs/ - It's a project that tries to port all the PHP functions to JavaScript.

Hope this helps