code: async function writeResourcesToDir({workspace, pattern, targetPath}) {
  	const fsTarget = resourceFactory.createAdapter({
  		fsBasePath: targetPath,
  		virBasePath: "/resources/"
  	});
  
  	let allResources;
  	if (workspace.byGlobSource) { // API only available on duplex collections
  		allResources = await workspace.byGlobSource(pattern);
  	} else {
  		allResources = await workspace.byGlob(pattern);
  	}
  
  	// write all resources to the tmp folder
  	await Promise.all(allResources.map((resource) => fsTarget.write(resource)));
  	return allResources.length;
  }
docs: Write resources from workspace matching the given pattern to the given fs destination
  
  @private
  @param {Object} parameters Parameters
  @param {module:@ui5/fs.DuplexCollection} parameters.workspace DuplexCollection to read and write files
  @param {string} parameters.pattern Pattern to match resources in workspace against
  @param {string} parameters.targetPath Path to write the resources to
  @returns {Promise<number>} Promise resolving with number of resources written to given directory