Lines Matching refs:async

21  * async.parallel([
22 * async.apply(fs.writeFile, 'testfile1', 'test1'),
23 * async.apply(fs.writeFile, 'testfile2', 'test2')
28 * async.parallel([
40 * node> var fn = async.apply(sys.puts, 'one');
86 * Take a sync function and make it async, passing its return value to a
88 * series, or other async functions. Any arguments passed to the generated
96 * This also means you can asyncify ES2017 `async` functions.
111 * async.waterfall([
112 * async.apply(fs.readFile, filename, "utf8"),
113 * async.asyncify(JSON.parse),
121 * async.waterfall([
122 * async.apply(fs.readFile, filename, "utf8"),
123 * async.asyncify(function (contents) {
133 * // supports async functions out of the box
134 * var q = async.queue(async.asyncify(async function(file) {
325 // for async generators
450 …* The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async oper…
457 * @see [async.eachOf]{@link module:Collections.eachOf}
461 * @param {number} limit - The maximum number of async operations at a time.
462 * @param {AsyncFunction} iteratee - An async function to apply to each
519 * @see [async.each]{@link module:Collections.each}
553 * async.forEachOf(validConfigFileMap, parseFile, function (err) {
564 * async.forEachOf(invalidConfigFileMap, parseFile, function (err) {
574 * async.forEachOf(validConfigFileMap, parseFile)
584 * async.forEachOf(invalidConfigFileMap, parseFile)
592 * // Using async/await
593 * async () => {
595 * let result = await async.forEachOf(validConfigFileMap, parseFile);
606 * async () => {
608 * let result = await async.forEachOf(invalidConfigFileMap, parseFile);
648 * @param {AsyncFunction} iteratee - An async function to apply to each item in
677 * async.map(fileList, getFileSizeInBytes, function(err, results) {
688 * async.map(withMissingFileList, getFileSizeInBytes, function(err, results) {
698 * async.map(fileList, getFileSizeInBytes)
708 * async.map(withMissingFileList, getFileSizeInBytes)
716 * // Using async/await
717 * async () => {
719 * let results = await async.map(fileList, getFileSizeInBytes);
730 * async () => {
732 * let results = await async.map(withMissingFileList, getFileSizeInBytes);
753 * for each of the applied async functions are passed to the final callback
772 * const appliedFn = async.applyEach([enableSearch, updateSchema], 'bucket')
780 * async.each(
782 * async (bucket) => async.applyEach([enableSearch, updateSchema], bucket)(),
789 …* The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation a…
795 * @see [async.eachOf]{@link module:Collections.eachOf}
799 * @param {AsyncFunction} iteratee - An async function to apply to each item in
812 …* The same as [`map`]{@link module:Collections.map} but runs only a single async operation at a ti…
818 * @see [async.map]{@link module:Collections.map}
821 * @param {AsyncFunction} iteratee - An async function to apply to each item in
836 …* The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async opera…
842 * @see [async.applyEach]{@link module:ControlFlow.applyEach}
915 * async.auto({
917 * // async code to get some data
921 * // async code to create a directory to store a file in
948 * async.auto({
951 * // async code to get some data
956 * // async code to create a directory to store a file in
981 * //Using async/await
982 * async () => {
984 * let results = await async.auto({
986 * // async code to get some data
990 * // async code to create a directory to store a file in
1067 throw new Error('async.auto task `' + key +
1171 'async.auto cannot execute tasks due to a recursive dependency'
1190 var FN_ARGS = /^(?:async\s+)?(?:function)?\s*\w*\s*\(\s*([^)]+)\s*\)(?:\s*{)/;
1191 var ARROW_FN_ARGS = /^(?:async\s+)?\(?\s*([^)=]+)\s*\)?(?:\s*=>)/;
1237 …* A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Depen…
1247 * otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}.
1253 * @see [async.auto]{@link module:ControlFlow.auto}
1272 * async.autoInject({
1274 * // async code to get some data
1278 * // async code to create a directory to store a file in
1305 * async.autoInject({
1740 * @see [async.queue]{@link module:ControlFlow.queue}
1753 * var cargo = async.cargo(function(tasks, callback) {
1790 * @see [async.queue]{@link module:ControlFlow.queue}
1791 * @see [async.cargo]{@link module:ControlFLow.cargo}
1807 * var cargoQueue = async.cargoQueue(function(tasks, callback) {
1833 * Reduces `coll` into a single value using an async `iteratee` to return each
1840 * needs to be async; if you can get the data before reducing it, then it's
1884 * async.reduce(fileList, 0, getFileSizeInBytes, function(err, result) {
1895 * async.reduce(withMissingFileList, 0, getFileSizeInBytes, function(err, result) {
1905 * async.reduce(fileList, 0, getFileSizeInBytes)
1915 * async.reduce(withMissingFileList, 0, getFileSizeInBytes)
1923 * // Using async/await
1924 * async () => {
1926 * let result = await async.reduce(fileList, 0, getFileSizeInBytes);
1937 * async () => {
1939 * let result = await async.reduce(withMissingFileList, 0, getFileSizeInBytes);
1972 * @see [async.compose]{@link module:ControlFlow.compose}
1984 * async.seq(
2055 * var add1mul3 = async.compose(mul3, add1);
2065 …* The same as [`map`]{@link module:Collections.map} but runs a maximum of `limit` async operations…
2071 * @see [async.map]{@link module:Collections.map}
2074 * @param {number} limit - The maximum number of async operations at a time.
2075 * @param {AsyncFunction} iteratee - An async function to apply to each item in
2090 …* The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async oper…
2096 * @see [async.concat]{@link module:Collections.concat}
2100 * @param {number} limit - The maximum number of async operations at a time.
2160 * async.concat(directoryList, fs.readdir, function(err, results) {
2170 * async.concat(withMissingDirectoryList, fs.readdir, function(err, results) {
2181 * async.concat(directoryList, fs.readdir)
2190 * async.concat(withMissingDirectoryList, fs.readdir)
2199 * // Using async/await
2200 * async () => {
2202 * let results = await async.concat(directoryList, fs.readdir);
2211 * async () => {
2213 * let results = await async.concat(withMissingDirectoryList, fs.readdir);
2229 …* The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation a…
2235 * @see [async.concat]{@link module:Collections.concat}
2269 * async.waterfall([
2270 * async.constant(42),
2277 * async.waterfall([
2278 * async.constant(filename, "utf8"),
2286 * async.auto({
2287 * hostname: async.constant("https://server.net/"),
2326 * Returns the first value in `coll` that passes an async truth test. The
2364 * async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists,
2373 * async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists)
2382 * // Using async/await
2383 * async () => {
2385 * let result = await async.detect(['file3.txt','file2.txt','dir1/file1.txt'], fileExists);
2402 …* The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async oper…
2409 * @see [async.detect]{@link module:Collections.detect}
2413 * @param {number} limit - The maximum number of async operations at a time.
2430 …* The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation a…
2436 * @see [async.detect]{@link module:Collections.detect}
2474 * Logs the result of an [`async` function]{@link AsyncFunction} to the
2478 * If multiple arguments are returned from the async function,
2499 * node> async.dir(hello, 'world');
2514 * @see [async.whilst]{@link module:ControlFlow.whilst}
2560 * @see [async.doWhilst]{@link module:ControlFlow.doWhilst}
2562 * @param {AsyncFunction} iteratee - An async function which is called each time
2602 * @param {AsyncFunction} iteratee - An async function to apply to
2625 * async.each(fileList, deleteFile, function(err) {
2634 * async.each(withMissingFileList, deleteFile, function(err){
2642 * async.each(fileList, deleteFile)
2650 * async.each(fileList, deleteFile)
2660 * // Using async/await
2661 * async () => {
2663 * await async.each(files, deleteFile);
2671 * async () => {
2673 * await async.each(withMissingFileList, deleteFile);
2691 …* The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operatio…
2697 * @see [async.each]{@link module:Collections.each}
2701 * @param {number} limit - The maximum number of async operations at a time.
2702 * @param {AsyncFunction} iteratee - An async function to apply to each item in
2717 …* The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a …
2726 * @see [async.each]{@link module:Collections.each}
2730 * @param {AsyncFunction} iteratee - An async function to apply to each
2745 * Wrap an async function and ensure it calls its callback on a later tick of
2750 * contained. ES2017 `async` functions are returned as-is -- they are immune
2758 * @param {AsyncFunction} fn - an async function, one that expects a node-style
2773 * async.mapSeries(args, sometimesAsync, done);
2777 * async.mapSeries(args, async.ensureAsync(sometimesAsync), done);
2797 * Returns `true` if every element in `coll` satisfies an async test. If any
2807 * @param {AsyncFunction} iteratee - An async truth test to apply to each item
2813 * depending on the values of the async tests. Invoked with (err, result).
2833 * async.every(fileList, fileExists, function(err, result) {
2839 * async.every(withMissingFileList, fileExists, function(err, result) {
2846 * async.every(fileList, fileExists)
2855 * async.every(withMissingFileList, fileExists)
2864 * // Using async/await
2865 * async () => {
2867 * let result = await async.every(fileList, fileExists);
2877 * async () => {
2879 * let result = await async.every(withMissingFileList, fileExists);
2896 …* The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operat…
2902 * @see [async.every]{@link module:Collections.every}
2906 * @param {number} limit - The maximum number of async operations at a time.
2907 * @param {AsyncFunction} iteratee - An async truth test to apply to each item
2913 * depending on the values of the async tests. Invoked with (err, result).
2922 …* The same as [`every`]{@link module:Collections.every} but runs only a single async operation at …
2928 * @see [async.every]{@link module:Collections.every}
2932 * @param {AsyncFunction} iteratee - An async truth test to apply to each item
2938 * depending on the values of the async tests. Invoked with (err, result).
2987 * Returns a new array of all the values in `coll` which pass an async truth
3020 * async.filter(files, fileExists, function(err, results) {
3031 * async.filter(files, fileExists)
3040 * // Using async/await
3041 * async () => {
3043 * let results = await async.filter(files, fileExists);
3060 …* The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async oper…
3067 * @see [async.filter]{@link module:Collections.filter}
3071 * @param {number} limit - The maximum number of async operations at a time.
3085 …* The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation a…
3091 * @see [async.filter]{@link module:Collections.filter}
3119 * @param {AsyncFunction} fn - an async function to call repeatedly.
3127 * async.forever(
3152 …* The same as [`groupBy`]{@link module:Collections.groupBy} but runs a maximum of `limit` async op…
3158 * @see [async.groupBy]{@link module:Collections.groupBy}
3161 * @param {number} limit - The maximum number of async operations at a time.
3162 * @param {AsyncFunction} iteratee - An async function to apply to each item in
3219 * @param {AsyncFunction} iteratee - An async function to apply to each item in
3247 * async.groupBy(files, detectFile, function(err, result) {
3262 * async.groupBy(files, detectFile)
3275 * // Using async/await
3276 * async () => {
3278 * let result = await async.groupBy(files, detectFile);
3298 …* The same as [`groupBy`]{@link module:Collections.groupBy} but runs only a single async operation…
3304 * @see [async.groupBy]{@link module:Collections.groupBy}
3307 * @param {AsyncFunction} iteratee - An async function to apply to each item in
3321 * Logs the result of an `async` function to the `console`. Only works in
3323 * as FF and Chrome). If multiple arguments are returned from the async
3344 * node> async.log(hello, 'world');
3350 …mapValues`]{@link module:Collections.mapValues} but runs a maximum of `limit` async operations at a
3357 * @see [async.mapValues]{@link module:Collections.mapValues}
3360 * @param {number} limit - The maximum number of async operations at a time.
3444 * async.mapValues(fileMap, getFileSizeInBytes, function(err, result) {
3459 * async.mapValues(withMissingFileMap, getFileSizeInBytes, function(err, result) {
3469 * async.mapValues(fileMap, getFileSizeInBytes)
3483 * async.mapValues(withMissingFileMap, getFileSizeInBytes)
3491 * // Using async/await
3492 * async () => {
3494 * let result = await async.mapValues(fileMap, getFileSizeInBytes);
3509 * async () => {
3511 * let result = await async.mapValues(withMissingFileMap, getFileSizeInBytes);
3526 …* The same as [`mapValues`]{@link module:Collections.mapValues} but runs only a single async opera…
3532 * @see [async.mapValues]{@link module:Collections.mapValues}
3550 * Caches the results of an async function. When creating a hash to store
3554 * **Note: if the async function errs, the result will not be cached and
3571 * @param {AsyncFunction} fn - The async function to proxy and cache results from.
3582 * var fn = async.memoize(slow_fn);
3633 * @see [async.setImmediate]{@link module:Utils.setImmediate}
3642 * async.nextTick(function() {
3648 * async.setImmediate(function (a, b, c) {
3697 * results from {@link async.parallel}.
3705 * [async functions]{@link AsyncFunction} to run.
3706 * Each async function can complete with any number of optional `result` values.
3716 * async.parallel([
3734 * async.parallel({
3751 * async.parallel([
3771 * async.parallel({
3789 * //Using async/await
3790 * async () => {
3792 * let results = await async.parallel([
3814 * async () => {
3816 * let results = await async.parallel({
3842 …* The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async
3849 * @see [async.parallel]{@link module:ControlFlow.parallel}
3852 * [async functions]{@link AsyncFunction} to run.
3853 * Each async function can complete with any number of optional `result` values.
3854 * @param {number} limit - The maximum number of async operations at a time.
3932 * const q = async.queue(worker, 2)
3961 * @param {AsyncFunction} worker - An async function for processing a queued task.
3973 * var q = async.queue(function(task, callback) {
4130 * The same as [async.queue]{@link module:ControlFlow.queue} only tasks are assigned a priority and
4137 * @see [async.queue]{@link module:ControlFlow.queue}
4139 * @param {AsyncFunction} worker - An async function for processing a queued task.
4206 * @param {Array} tasks - An array containing [async functions]{@link AsyncFunction}
4214 * async.race([
4249 * @see [async.reduce]{@link module:Collections.reduce}
4271 * Wraps the async function in another function that always completes with a
4281 * @param {AsyncFunction} fn - The async function you want to wrap
4287 * async.parallel([
4288 * async.reflect(function(callback) {
4292 * async.reflect(function(callback) {
4296 * async.reflect(function(callback) {
4338 * @see [async.reflect]{@link module:Utils.reflect}
4341 * [async functions]{@link AsyncFunction} to wrap in `async.reflect`.
4342 * @returns {Array} Returns an array of async functions, each wrapped in
4343 * `async.reflect`
4363 * async.parallel(async.reflectAll(tasks),
4389 * async.parallel(async.reflectAll(tasks),
4421 …* The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async`…
4427 * @see [async.filter]{@link module:Collections.filter}
4430 * @param {Function} iteratee - An async truth test to apply to each item in
4453 * async.reject(fileList, fileExists, function(err, results) {
4459 * async.reject(fileList, fileExists)
4468 * // Using async/await
4469 * async () => {
4471 * let results = await async.reject(fileList, fileExists);
4488 …* The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async oper…
4495 * @see [async.reject]{@link module:Collections.reject}
4498 * @param {number} limit - The maximum number of async operations at a time.
4499 * @param {Function} iteratee - An async truth test to apply to each item in
4513 …* The same as [`reject`]{@link module:Collections.reject} but runs only a single async operation a…
4519 * @see [async.reject]{@link module:Collections.reject}
4522 * @param {Function} iteratee - An async truth test to apply to each item in
4552 * @see [async.retryable]{@link module:ControlFlow.retryable}
4567 * @param {AsyncFunction} task - An async function to retry.
4581 * async.retry(3, apiMethod, function(err, result) {
4586 * async.retry({times: 3, interval: 200}, apiMethod, function(err, result) {
4592 * async.retry({
4602 * async.retry(apiMethod, function(err, result) {
4608 * async.retry({
4618 * async.auto({
4620 * payments: async.retryable(3, api.getPayments.bind(api))
4644 throw new Error("Invalid arguments for async.retry");
4679 throw new Error("Invalid arguments for async.retry");
4692 * @see [async.retry]{@link module:ControlFlow.retry}
4705 * async.auto({
4706 * dep1: async.retryable(3, getFromFlakyService),
4707 * process: ["dep1", async.retryable(3, function (results, cb) {
4748 * results from {@link async.series}.
4765 * [async functions]{@link AsyncFunction} to run in series.
4775 * async.series([
4778 * // do some async task
4784 * // then do another async task
4794 * async.series({
4797 * // do some async task
4803 * // then do another async task
4813 * async.series([
4832 * async.series({
4835 * // do some async task
4841 * // then do another async task
4852 * //Using async/await
4853 * async () => {
4855 * let results = await async.series([
4858 * // do some async task
4864 * // then do another async task
4878 * async () => {
4880 * let results = await async.parallel({
4883 * // do some async task
4889 * // then do another async task
4908 * Returns `true` if at least one element in the `coll` satisfies an async test.
4919 * @param {AsyncFunction} iteratee - An async truth test to apply to each item
4925 * Result will be either `true` or `false` depending on the values of the async
4943 * async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists,
4951 * async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists,
4960 * async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists)
4969 * async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists)
4978 * // Using async/await
4979 * async () => {
4981 …* let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], …
4991 * async () => {
4993 …* let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt']…
5010 …* The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operatio…
5016 * @see [async.some]{@link module:Collections.some}
5020 * @param {number} limit - The maximum number of async operations at a time.
5021 * @param {AsyncFunction} iteratee - An async truth test to apply to each item
5027 * Result will be either `true` or `false` depending on the values of the async
5037 …* The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a …
5043 * @see [async.some]{@link module:Collections.some}
5047 * @param {AsyncFunction} iteratee - An async truth test to apply to each item
5053 * Result will be either `true` or `false` depending on the values of the async
5063 * Sorts a list by the results of running each `coll` value through an async
5072 * @param {AsyncFunction} iteratee - An async function to apply to each item in
5099 * async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], getFileSizeInBytes,
5116 * async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], function(file, callback) {
5134 * async.sortBy(['bigfile.txt','mediumfile.txt','smallfile.txt'], function(file, callback) {
5154 * async.sortBy(['mediumfile.txt','smallfile.txt','missingfile.txt'], getFileSizeInBytes,
5166 * async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], getFileSizeInBytes)
5177 * async.sortBy(['mediumfile.txt','smallfile.txt','missingfile.txt'], getFileSizeInBytes)
5185 * // Using async/await
5186 * (async () => {
5188 …* let results = await async.sortBy(['bigfile.txt','mediumfile.txt','smallfile.txt'], getFi…
5200 * async () => {
5202 …* let results = await async.sortBy(['missingfile.txt','mediumfile.txt','smallfile.txt'], g…
5241 * @param {AsyncFunction} asyncFn - The async function to limit in time.
5262 * var wrapped = async.timeout(myFunction, 1000);
5312 …* The same as [times]{@link module:ControlFlow.times} but runs a maximum of `limit` async operatio…
5319 * @see [async.times]{@link module:ControlFlow.times}
5322 * @param {number} limit - The maximum number of async operations at a time.
5323 * @param {AsyncFunction} iteratee - The async function to call `n` times.
5325 * @param {Function} callback - see [async.map]{@link module:Collections.map}.
5341 * @see [async.map]{@link module:Collections.map}
5344 * @param {AsyncFunction} iteratee - The async function to call `n` times.
5350 * // Pretend this is some complicated async factory
5358 * async.times(5, function(n, next) {
5371 …* The same as [times]{@link module:ControlFlow.times} but runs only a single async operation at a …
5377 * @see [async.times]{@link module:ControlFlow.times}
5380 * @param {AsyncFunction} iteratee - The async function to call `n` times.
5436 * async.transform(fileList, transformFileSize, function(err, result) {
5446 * async.transform(fileList, transformFileSize)
5454 * // Using async/await
5455 * (async () => {
5457 * let result = await async.transform(fileList, transformFileSize);
5493 * async.transform(fileMap, transformFileSize, function(err, result) {
5503 * async.transform(fileMap, transformFileSize)
5511 * // Using async/await
5512 * async () => {
5514 * let result = await async.transform(fileMap, transformFileSize);
5560 * async.tryEach([
5605 * @see [async.memoize]{@link module:Utils.memoize}
5627 * @param {AsyncFunction} iteratee - An async function which is called each time
5637 * async.whilst(
5685 * @see [async.whilst]{@link module:ControlFlow.whilst}
5689 * @param {AsyncFunction} iteratee - An async function which is called each time
5700 * async.until(function test(cb) {
5729 * @param {Array} tasks - An array of [async functions]{@link AsyncFunction}
5739 * async.waterfall([
5756 * async.waterfall([
5800 * An "async function" in the context of Async is an asynchronous function with
5812 * This type of function is also referred to as a "Node-style async function",
5814 * library are themselves CPS/Node-style async functions, or functions that
5815 * return CPS/Node-style async functions.
5817 * Wherever we accept a Node-style async function, we also directly accept an
5818 …* [ES2017 `async` function]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Referenc…
5819 * In this case, the `async` function will not be passed a final callback
5825 * Note, due to JavaScript limitations, we can only detect native `async`
5827 * Your environment must have `async`/`await` support for this to work.
5829 * If you are using `async` functions through a transpiler (e.g. Babel), you
5831 * because the `async function` will be compiled to an ordinary function that