I am using gulp-zip to zip up my source files. So I have a main folder called FIFA which has other sub folders which might have more sub folders and files. In additon the FIFA folder also has files like my package.json, gulp.js and some other files. I want to basically use gulp-zip to zip up my entire project and create a folder called distribution and save the zip inside it. So this is the code i used.
gulp.task('zip', function () {
return gulp.src('./*,')
.pipe(zip('test.zip'))
.pipe(gulp.dest('./distribution'));
});
The issue is that although a zip is created inside the distribution folder that zip only contains the files inside the FIFA folder, all the files inside the subfolders of FIFA are not there. So for instance if FIFA has a subfolder called ronaldo and ronaldo contains goal.js that goal.js is not in the zip. What have i done wrong? Please advice.
Try it with two *
gulp.task('zip', function () {
return gulp.src('./**')
.pipe(zip('test.zip'))
.pipe(gulp.dest('./distribution'));
});
What's the difference between * and **?
One star means all files, no folders - too stars will be more deep and also include all the folders inside the specified folder.
And for instance if you wanted to do two stars to include all folders EXCEPT one specific folder , is that possible to do also?
You can use an exclamation mark like !./excludedDir, pass src as an array with the !... as one of the values
Related
I'm currently using Meteor and trying to learn more about the framework. In the documentation about special directories the following is said about the public/ special directory:
All files inside a top-level directory called public/ are served as-is to the client. When referencing these assets, do not include public/ in the URL, write the URL as if they were all in the top level. For example, reference public/bg.png as <img src='/bg.png' />. This is the best place for favicon.ico, robots.txt, and similar files.
My question is: since I refer to files inside of public/ directory as if they were located in the root folder of my application, what's the different between putting the files in the public/ folder and in the root folder? Or is it just for organization sake?
Also the documentation I quoted above makes some examples using assets (some pngs and favicon.ico) and no JavaScript or HTML files. Am I able to put some JavaScript code in there and then import them in another file by referencing as if this code was located in the root of my app? Or is the public/ directory somewhat made only for assets?
I failed to find any docs that explains what is done to files inside this directory in detail (I only found what I quoted above). So if any documentation of that kind is available it would help a lot!
My question is: since I refer to files inside of public/ directory as if they were located in the root folder of my application, what's the different between putting the files in the public/ folder and in the root folder? Or is it just for organization sake?
Just because you can reference or "import" a file from public/ doesn't mean it functions in the same way to how a normal file import would work. Files located in public gets served as is without being minified/run through the Meteor pipleline. Second, these files are accessible to the client which makes sense given how'd import them without preceding slashes and keep them mostly to serve stuff like favicon and what not.
So in a sense, such files within public are made available within relation to your client bundle/code whilst not being a part of them, get it?
This way of serving assets isn't unique to Meteor, even React has a public directory.
Also the documentation I quoted above makes some examples using assets (some pngs and favicon.ico) and no JavaScript or HTML files. Am I able to put some JavaScript code in there and then import them in another file by referencing as if this code was located in the root of my app? Or is the public/ directory somewhat made only for assets?
AFAIK, you can have files of any type in public but since
It's served as is to the client, meaning it's exposed to the public
It doesn't get minified (i.e being part of the final application build code)
You're advised to not have any of the application code within this directory.
The Public folder is how you serve your static files, when you put a file in your root folder it will not be sent to the client by default and you can't use it in your css, when you put that file (say an image) in your public folder you can use it from the css and refer to it as if it was in your root folder, so if I put a.jpg in the public folder I can use url(/a.jpg) in my css, that won't work if a.jpg is simply in your root folder, that's what the docs mean when they say it's served as if it was the root folder.
unlike in Rails, Meteor initiatives don’t have a rigid document structure and you are quite a whole lot free to prepare your projects as you want. a few folder names but have unique which means, and documents within them will be dealt with in a different way.
consumer
files here will be loaded at the client simplest. files in that folder don’t need things like Meteor.isClient.
server
Loaded on the server best, duh! No need for Meteor.isServer whilst files are in that folder, the client won’t see these files.
public
This directory is for property like photographs. on your initiatives, you reference stuff in the public folder as if they have been in the root folder. as an example, when you have a report: public/nude.jpg, then for your app you include it with .
personal
files only available at the server facet thru the assets API.
checks
documents in there received’t be loaded anywhere and are used for checking out your app.
lib
documents in that folder are loaded earlier than whatever else, which makes it the best listing to vicinity the distinct libraries used on a undertaking.
I have a file myarchive.zip that contains many directories, files, etc. Let's say this myarchive.zip file lives in a directory called "b". Currently, I am using the unzip module in Nodejs, using that I am able to create a directory by default called "myarchive" with the contents of the zip file. I do not want the code to create this "myarchive" directory - I just want the contents to be extracted to directory "b". Is this possible? If so, then how. Thanks!
The function that I am currently using for unzipping is:
const extractArchive = async (inputFileName, extractToDirectory) => {
fs.createReadStream(inputFileName)
.pipe(unzip.Extract({
path: extractToDirectory
}));
PS: inputFileName is the path of the zip file(base directory in which zip is present+ the file name)
I read many documents about getFilesAsync(), but most of them give examples with just a list of file names in a folder. How do I use getFilesAsync() to create an array of files inside the folder?
I have a project with a certain folder structure and an other project which should be basically the same only some files are different.
I would like to write a gulp-task (or tasks) which are copying the first projects folder structure, but only create symlinks for the files, and don't overwrite files already in the other project.
I found out that I can create symlinks with gulp and vinyl-fs.
I tried to create a two step task. First, I tried to copy the folder structure, but I don't know how can I tell gulp that I only care about the folder structure.
Then second, I wanted to create a symlink task that is creating the symlinks in the correct directory.
Maybe, I could create it with only vinyl-fs's symlinks using a function parameter, but I can't find out how.
It would seem you can do this to copy only folders (exclude *.*):
gulp
.src(['base/path/**/*', '!base/path/**/*.*'])
.pipe(gulp.dest('target'));
Assuming all your files have some kind of extension (e.g. *.jpg).
For the symlinks, doesn't the following work?:
var vfs = require('vinyl-fs');
...
vfs
.src('base/path/**/*', { followSymlinks: false, nodir: true })
.pipe(vfs.symlink('target'));
...
My current problem is that starting from the root folder I have to look into each folder and if one file exists then save it as a pdf with the folder name in a different location. If more then one file exists then combine this into one file, save it as a pdf with the folder name in a different location.
Example:
- Root Folder
- Folder1
- FileA.tif
- FileB.tif
- Folder2
- FileC.tif
- Result Folder
- Folder1.pdf (Contains FileA.tif and FileB.tif combined into one pdf)
- Folder2.pdf (Contains FileC.tif as pdf)
I am currently using Acrobat 9 Professional. I know I can do this manually, but I have to do this for hundreds of folders and each folder has one or more files.
My preffered solution would be in Acrobat Javascript on Windows XP.
Somethings that I am trying to figure out is if I can do some sort of:
For each folder in Root Folder
For each file in folder (Save the folder name too)
Combine files (I think I can mange this based on some examples I have seen)
I think that would give me a good start.
Any help would be greatly appreciated.
GhostView is a command-line program that can manipulate PDF files. Years ago, I used this to concatenate thousands of PDF files into a single PDF for download. It can convert multiple file types to PDF, plus you can apply all of the PDF security options to your final PDF as needed. You'll need the commercial version if you're packaging this for a product.
I am trying to solve the same problem here.
You need to install GhostScript and use some bat file to do the job.
I started to write this:
#echo off
set folpath=%~dp0
set PROG="c:\Program Files\gs\gs9.04\bin\gswin64"
set OUT= "%folpath%Combined.pdf"
pushd "%~dp0"
call %PROG% -o %OUT% -sOUTPUTFILE="%folpath%Merged.pdf" -dBATCH "%folpath%doc2.pdf" "%folpath%doc1.pdf"
pause
But it is not ready :)