diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2011-06-15 14:43:37 +0200 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2011-06-15 14:43:37 +0200 |
commit | 3d7d994ffce2e79d516f76d7384a411b21021142 (patch) | |
tree | bc557287ad6ea87574a339f59ea9f7c5bccfca9a /doc | |
parent | 86214c9f164c152b57b140d33deefa48eff50920 (diff) | |
parent | 88552c51aead1520a0d20d42b4af39520baab5d1 (diff) | |
download | android-node-v8-3d7d994ffce2e79d516f76d7384a411b21021142.tar.gz android-node-v8-3d7d994ffce2e79d516f76d7384a411b21021142.tar.bz2 android-node-v8-3d7d994ffce2e79d516f76d7384a411b21021142.zip |
Merge branch 'v0.4'
Conflicts:
doc/api/modules.markdown
test/simple/test-crypto.js
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/crypto.markdown | 10 | ||||
-rw-r--r-- | doc/api/modules.markdown | 18 |
2 files changed, 24 insertions, 4 deletions
diff --git a/doc/api/crypto.markdown b/doc/api/crypto.markdown index 0c0134c39a..19b88c2f86 100644 --- a/doc/api/crypto.markdown +++ b/doc/api/crypto.markdown @@ -139,11 +139,13 @@ This is the mirror of the signing object above. Updates the verifier object with data. This can be called many times with new data as it is streamed. -### verifier.verify(cert, signature, signature_format='binary') +### verifier.verify(object, signature, signature_format='binary') -Verifies the signed data by using the `cert` which is a string containing -the PEM encoded certificate, and `signature`, which is the previously calculated -signature for the data, in the `signature_format` which can be `'binary'`, `'hex'` or `'base64'`. +Verifies the signed data by using the `object` and `signature`. `object` is a +string containing a PEM encoded object, which can be one of RSA public key, +DSA public key, or X.509 certificate. `signature` is the previously calculated +signature for the data, in the `signature_format` which can be `'binary'`, +`'hex'` or `'base64'`. Returns true or false depending on the validity of the signature for the data and public key. diff --git a/doc/api/modules.markdown b/doc/api/modules.markdown index 1bb185e176..2e943bf2c1 100644 --- a/doc/api/modules.markdown +++ b/doc/api/modules.markdown @@ -330,6 +330,7 @@ Because `module` provides a `filename` property (normally equivalent to `__filename`), the entry point of the current application can be obtained by checking `require.main.filename`. + ## AMD Compatibility Node's modules have access to a function named `define`, which may be @@ -362,6 +363,23 @@ The example module above could be structured like so: Node executes the callback immediately, so please plan your programs accordingly. + +### Accessing the main module + +When a file is run directly from Node, `require.main` is set to its +`module`. That means that you can determine whether a file has been run +directly by testing + + require.main === module + +For a file `foo.js`, this will be `true` if run via `node foo.js`, but +`false` if run by `require('./foo')`. + +Because `module` provides a `filename` property (normally equivalent to +`__filename`), the entry point of the current application can be obtained +by checking `require.main.filename`. + + ## Addenda: Package Manager Tips The semantics of Node's `require()` function were designed to be general |