Create the archive and call `archive.ready()` before callback.
Set `archive.resumed` if archive has a content feed.
@private
342721
function create () {
    if (dir && !opts.temp && !key && (opts.indexing !== false)) {
      // Only set opts.indexing if storage is dat-storage
      // TODO: this should be an import option instead, https://github.com/mafintosh/hyperdrive/issues/160
      opts.indexing = true
    }
    if (!key) return createArchive()

    resolveDatLink(key, function (err, resolvedKey) {
      if (err) return cb(err)
      key = resolvedKey
      createArchive()
    })

    function createArchive () {
      archive = hyperdrive(storage, key, opts)
      archive.on('error', cb)
      archive.ready(function () {
        debug('archive ready. version:', archive.version)
        if (hasDat || (archive.metadata.has(0) && archive.version)) {
          archive.resumed = true
        } else {
          archive.resumed = false
        }
        archive.removeListener('error', cb)

        cb(null, Dat(archive, opts))
      })
    }
  }
1057628
def archive(self):
        

        self._client._put(
            "{0}/archived".format(
                self.__class__.base_url(
                    self.sys['space'].id,
                    self.sys['id'],
                    environment_id=self._environment_id
                ),
            ),
            {},
            headers=self._update_headers()
        )

        return self.reload()
1253884
function create(item, model, data) {
    var serverProps = serverProperties(item, model, data).properties;
    return utils.socketPut(model.io, model.url + '/create/', serverProps).then(function(response) {
        _.merge(serverProps, response);
        return update(item, model, serverProps);
    }).then(function() {
        // Refresh all items that were referenced - some of their properties might change
        return Promise.all(_.map(serverProps.refresh, function(item) {
            return item.refresh();
        }));
    });
}
306830
def do_archive(self, line):
        """"""
        pids = self._split_args(line, 1, -1)
        self._command_processor.science_object_archive(pids)
        self._print_info_if_verbose(
            "Added archive operation for identifier(s) {} to write queue".format(
                ", ".join(pids)
            )
        )
1251969
def deploy!(archive, env)
            archive.upload(Beanstalk.api)
            
            if env.status.empty?
                puts "Creating stack '#{@stack}' for #{archive.app_name}-#{archive.version}..."
                env.create!(archive, @stack, @cnames, @config)
                env.wait_until_status_is_not "Launching"
            else
                puts "Deploying #{archive.version} to #{env.name}..."
                env.deploy!(archive, @config)
                env.wait_until_status_is_not "Updating"
            end
            
            env.wait_until_healthy
            puts "Done. Visit http://#{env.url} in your browser."
            DeploymentInfo.new env, archive
        end
906893
@Override
	public void execute() {
		// save archive dir of the outer module so it can be reset later
		String previousArchiveDir = archiveDirProvider.get().getPath();

		try {
			// make sure archive dirs are within that of the container module
			moduleArchiveDir = moduleArchiveDirProvider.get().getPath();
			config.put(JFunkConstants.ARCHIVE_DIR, moduleArchiveDir);

			for (ModuleWithCallbacks moduleWithCallbacks : modulesWithCallbacks) {
				TestModule testModule = moduleWithCallbacks.testModule;

				Runnable beforeModuleCallback = moduleWithCallbacks.beforeModuleCallback;
				if (beforeModuleCallback != null) {
					beforeModuleCallback.run();
				}

				scriptContext.run(testModule);

				Runnable afterModuleCallback = moduleWithCallbacks.afterModuleCallback;
				if (afterModuleCallback != null) {
					afterModuleCallback.run();
				}
			}
		} finally {
			// reset for outer module, so property is correctly archived
			config.put(JFunkConstants.ARCHIVE_DIR, previousArchiveDir);

			// it does not make sense to archive datasets in the container module,
			// these would be those of the test module executed last
			config.put(JFunkConstants.ARCHIVE_DATASETS, "false");
		}
	}
1201274
function init() {
    try {
        keepOrganized().then((AllFiles) => {
            console.log('Marked Reference Links');
            console.log('Created Directory Tree');
            console.log('Setting up watchers...');
            let watcher = new Watcher(AllFiles);
            console.log('Watching for file changes...');
            watcher.on('update', () => {
                console.log('Updating dirTree...')
                keepOrganized().then((AllFiles) => {
                    console.log('Updated dirTree.');
                    watcher.update(AllFiles);
                })
            })
        })
    } catch (err) {
        console.error(err);
    }
}
901812
function archiveOriginal(callback) {
      const archivedOriginal = path.join(outdirectory, '/archived.kml');
      const infileContents = fs.readFileSync(infile);

      fs.writeFile(archivedOriginal, infileContents, (err) => {
        if (err) return callback(err);
        return callback();
      });
    }
400148
function download (archive, name, cb) {
  return maybe(cb, async function () {
    // lookup the entry
    var entry = await stat(archive, name)
    if (!entry) {
      throw new NotFoundError(`The entry ${name} was not found in the archive.`)
    }

    // recurse on a directory
    if (entry.isDirectory()) {
      let listing = await readdir(archive, name)
      let promises = listing.map(subname => download(archive, path.join(name, subname)))
      return Promise.all(promises)
    }

    // prioritize a file
    if (entry.isFile()) {
      if (entry.downloaded === entry.blocks) {
        return // already downloaded
      }
      return new Promise((resolve, reject) => {
        archive.content.download({
          start: entry.offset,
          end: entry.offset + entry.blocks
        }, err => {
          if (err) reject(err)
          else resolve()
        })
      })
    }
  })
}
617793
function _doLaunchAfterServerReady(initialDoc) {
        // update status
        _setStatus(STATUS_CONNECTING);
        _createLiveDocumentForFrame(initialDoc);

        // start listening for requests
        _server.start();

        // Install a one-time event handler when connected to the launcher page
        Inspector.one("connect", _onConnect);

        // open browser to the interstitial page to prepare for loading agents
        _openInterstitialPage();

        // Once all agents loaded (see _onInterstitialPageLoad()), begin Live Highlighting for preprocessor documents
        _openDeferred.done(function () {
            // Setup activeEditorChange event listener so that we can track cursor positions in
            // CSS preprocessor files and perform live preview highlighting on all elements with
            // the current selector in the preprocessor file.
            EditorManager.on("activeEditorChange", onActiveEditorChange);

            // Explicitly trigger onActiveEditorChange so that live preview highlighting
            // can be set up for the preprocessor files.
            onActiveEditorChange(null, EditorManager.getActiveEditor(), null);
        });
    }
133190
function whenDocumentReady( callback ) {
   return new Promise( ( resolve, reject ) => {
      function ready() {
         try {
            resolve( callback() );
         }
         catch( err ) {
            reject( err );
         }
      }

      if( document.readyState === 'complete' || document.readyState === 'interactive' ) {
         ready();
      }
      else {
         document.addEventListener( 'DOMContentLoaded', ready );
      }
   } );
}
954139
function archive(cb) {
  db.getClient(function(err, client, done) {
    client.query(qb.select() + ' WHERE published = true', function(err, r) {
      if(err) {
        cb(err);
        done(err);
      } else {
        cb(null, r.rows);
        done();
      }
    });
  });
}
817798
function (context, callback) {

            if (this.$resourceConfiguration.$.upsert === true) {
                callback(new HttpError("Please create with PUT", 405));
                return;
            }

            var self = this,
                model,
                processor;

            flow()
                .seq("collection", function (cb) {
                    self._findCollection(context, cb);
                })
                .seq(function () {
                    model = this.vars.collection.createItem();

                    var payload = context.request.params;

                    processor = self.$restHandler.$restDataSource.getProcessorForModel(model);

                    model.set(processor.parse(model, payload));

                    if (model.createdField) {
                        model.set(model.createdField, new Date());
                    }
                })
                .seq(function () {
                    self._generateAutoValues(model);
                })
                .seq(function (cb) {
                    self._validate(model, context, cb);
                })
                .seq(function (cb) {
                    self._beforeModelSave(model, context, cb);
                })
                .seq(function (cb) {
                    self._beforeModelCreate(model, context, cb);
                })
                // validate and save model
                .seq(function (cb) {
                    model.validateAndSave({action: DataSource.ACTION.CREATE }, cb);
                })
                .seq(function (cb) {
                    self._afterModelCreate(model, context, cb);
                }).
                exec(function (err, results) {
                    if (!err) {
                        // TODO: do correct invalidation
                        results.collection.invalidatePageCache();

                        var body = JSON.stringify(processor.compose(model, null));

                        var response = context.response;
                        response.writeHead(201, "", {
                            'Content-Type': 'application/json',
                            'Location': context.request.urlInfo.uri + "/" + model.identifier()
                        });

                        response.write(body);
                        response.end();

                        callback(null);
                    } else {
                        if (!(err instanceof HttpError)) {
                            var statusCode = 400;
                            // TODO: add more error handling
                            err = new HttpError(err, statusCode);
                        }
                        callback(err);
                    }
                });
        }
160190
def _archive(self):
        
        archive, archive_file = _retrieve_archive()

        if self.backup:
            self.backup.add_archive(archive)

        if archive:
            from topydo.commands.ArchiveCommand import ArchiveCommand
            command = ArchiveCommand(self.todolist, archive)
            command.execute()

            if archive.dirty:
                archive_file.write(archive.print_todos())
1128943
function reuse() {
      if(!storage[storageKey] && post.collection('parent') && post.collection('parent')[storageKey]){
        $contentDomNode.html(post.collection('parent')[storageKey]);
        $contentDomNode.attr('data-div-placeholder-content', 'true');
        saveData();
      }
    }
790636
function (evts, callback) {
    this.replayStreamed(function (replay, done) {
      evts.forEach(function (evt) {
        replay(evt);
      });
      done(callback);
    });
  }
101295
def log(ctx, archive_name):
    '''
    
    '''

    _generate_api(ctx)
    ctx.obj.api.get_archive(archive_name).log()